Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #123

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions .cspell.json

This file was deleted.

81 changes: 0 additions & 81 deletions .github/workflows/mega-linter.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ lib/
*.bak
*.tmp
npm-debug.log
*.log
report/
59 changes: 27 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Create stats of your source code:
[![Dependency Status](https://gemnasium.com/flosse/sloc.svg)](https://gemnasium.com/flosse/sloc)
[![NPM version](https://badge.fury.io/js/sloc.svg)](http://badge.fury.io/js/sloc)
[![Bower version](https://img.shields.io/bower/v/sloc.svg)](https://github.com/flosse/sloc)
[![Mega-Linter](https://github.com/flosse/sloc/workflows/Mega-Linter/badge.svg?branch=master)](https://github.com/nvuillam/mega-linter#readme)
[![License](https://img.shields.io/npm/l/sloc.svg)](https://github.com/flosse/sloc/blob/master/LICENCE.txt)
[![Minified size](http://img.shields.io/badge/size-6,1K-blue.svg)](https://github.com/flosse/sloc)

Expand All @@ -26,19 +25,19 @@ In addition to the default terminal output (see examples below), sloc provides a

- CSV
- JSON
- Command line table
- Commandline table

## Install

To use sloc as an application install it globally:

```shell
```
sudo npm install -g sloc
```

If you're going to use it as a Node.js module within your project:

```shell
```
npm install --save sloc
```

Expand All @@ -54,43 +53,43 @@ Link `sloc.js` in your HTML file:

sloc is also available via [bower](http://twitter.github.com/bower/):

```shell
```
bower install sloc
```

**Note**:
You need to compile the coffee-script files yourself.
If you want to use a pre-compiled bower package, you can run
If you want to use a precompiled bower package, you can run

```shell
```
bower install sloc-bower
```

## Usage

### CLI

```shell
```
sloc [option] <file>|<directory>
```

Options:

```shell
```
-h, --help output usage information
-V, --version output the version number
-e, --exclude <regex> regular expression to exclude files and folders
-i, --include <regex> regular expression to include files and folders
-f, --format <format> format output: json, csv, cli-table
--format-option [value] add formatter option
-k, --keys <keys> report only numbers of the given keys
-d, --details report stats of each analyzed file
-d, --details report stats of each analzed file
-a, --alias <custom ext>=<standard ext> alias custom ext to act like standard ext (eg. php5=php,less=css)
```

e.g.:

```shell
```
$ sloc src/

---------- Result ------------
Expand All @@ -110,7 +109,7 @@ Number of files read : 10

or

```shell
```
$ sloc --details \
--format cli-table \
--keys total,source,comment \
Expand Down Expand Up @@ -153,7 +152,7 @@ fs.readFile("mySourceFile.coffee", "utf8", function(err, code){
});
```

### Browser usage
### Browser

```javascript
var sourceCode = "foo();\n /* bar */\n baz();";
Expand All @@ -178,29 +177,29 @@ var stats = window.sloc(sourceCode,"javascript");
### sloc adapters

- Grunt
- [grunt-sloc](https://github.com/rhiokim/grunt-sloc).
- [grunt-sloccount](https://github.com/asciidisco/grunt-sloccount)
- [grunt-maxlines](https://github.com/zerok/grunt-maxlines)
- [grunt-file-sloc](https://github.com/bubkoo/grunt-file-sloc)
- [grunt-sloc](https://github.com/rhiokim/grunt-sloc).
- [grunt-sloccount](https://github.com/asciidisco/grunt-sloccount)
- [grunt-maxlines](https://github.com/zerok/grunt-maxlines)
- [grunt-file-sloc](https://github.com/bubkoo/grunt-file-sloc)

- Gulp
- [gulp-sloc](https://github.com/oddjobsman/gulp-sloc):
- [gulp-sloc2](https://github.com/pnarielwala/gulp-sloc2)
- [gulp-sloc](https://github.com/oddjobsman/gulp-sloc):
- [gulp-sloc2](https://github.com/pnarielwala/gulp-sloc2)

- [Atom](https://atom.io/)

- [atom-sloc](https://github.com/sgade/atom-sloc)
- [line-count](https://github.com/mark-hahn/line-count)
- [atom-sloc](https://github.com/sgade/atom-sloc)
- [line-count](https://github.com/mark-hahn/line-count)

- Jenkins
- [sloc-for-jenkins](https://www.npmjs.com/package/sloc-for-jenkins)
- [sloccount](https://github.com/asciidisco/sloccount)
- [sloc-for-jenkins](https://www.npmjs.com/package/sloc-for-jenkins)
- [sloccount](https://github.com/asciidisco/sloccount)

- Istanbul
- [istanbul-reporter-clover-limits](https://github.com/Cellarise/istanbul-reporter-clover-limits/)
- Istanbbul
- [istanbul-reporter-clover-limits](https://github.com/Cellarise/istanbul-reporter-clover-limits/)

- Codemetrics
- [codemetrics-process-sloc](https://github.com/maxdow/codemetrics-process-sloc)
- [codemetrics-process-sloc](https://github.com/maxdow/codemetrics-process-sloc)

## Supported languages

Expand Down Expand Up @@ -262,15 +261,11 @@ var stats = window.sloc(sourceCode,"javascript");

## Run tests

```shell
npm test
```
npm test

## Build

```shell
npm run prepublish
```
npm run prepublish

## Changelog

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"readdirp": "^2.1.0"
},
"devDependencies": {
"chai": "~3.5.0",
"coffee-script": "~1.12.3",
"coffeelint": "^1.16.0",
"chai": "^4.3.4",
"coffeelint": "^2.1.0",
"coffeescript": "^2.5.1",
"coveralls": "^2.11.15",
"istanbul": "^0.4.5",
"mocha": "~3.2.0"
"mocha": "^8.3.2"
},
"repository": {
"type": "git",
Expand All @@ -55,6 +55,6 @@
"lint": "coffeelint src/",
"watch": "coffee -o lib -cw src/",
"prepublish": "coffee -o lib/ -c src/",
"test": "npm run lint && mocha --reporter spec --compilers coffee:coffee-script/register --recursive spec/*.spec.coffee"
"test": "npm run lint && mocha --require coffeescript/register --recursive spec/*.spec.coffee"
}
}
6 changes: 3 additions & 3 deletions spec/languages.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ module.exports =
source() /* one line block */
/* one line block */ code()
/* block */ code() /*
*/ source() # comment /* no block */
*/ souce() # comment /* no block */
"""
comment: 9
source: 5
Expand Down Expand Up @@ -521,7 +521,7 @@ module.exports =
source() =begin one line block=end
=begin one line block =end code()
=begin block =end code() =begin
=end source() # comment =begin no block =end
=end souce() # comment =begin no block =end
"""
comment: 9
source: 5
Expand Down Expand Up @@ -715,7 +715,7 @@ module.exports =
"""
// comment
body
font: 100% Helvetica, sans-serif /* multi
font: 100% Helvecia, sans-serif /* multi
line comments */
"""
comment: 3
Expand Down
2 changes: 1 addition & 1 deletion spec/sloc.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe "The sloc module", ->
res.todo.should.equal 0
done()

it "evaluates an empty file correctly", (done) ->
it "evaluates an emty file correctly", (done) ->
fs.readFile "./spec/testfiles/empty.js", "utf-8", (err, code) ->
res = sloc code, "js"
res.empty.should.equal 1
Expand Down
5 changes: 3 additions & 2 deletions src/sloc.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###
This program is distributed under the terms of the MIT license.
Copyright 2012 - 2018 (c) Markus Kohlhase <mail@markus-kohlhase.de>
Copyright 2012 - 2021 (c) Markus Kohlhase <mail@markus-kohlhase.de>
###

keys = [
Expand Down Expand Up @@ -29,7 +29,8 @@ getCommentExpressions = (lang) ->

when "coffee", "iced"
/\#[^\{]/ # hashtag not followed by opening curly brace
when "cr", "py", "ls", "mochi", "nix", "r", "rb", "jl", "pl", "yaml", "hr", "rpy"
when "cr", "py", "ls", "mochi", "nix", "r", "rb", "jl", "pl", "yaml", \
"hr", "rpy"
/\#/
when "js", "jsx", "mjs", "c", "cc", "cpp", "cs", "cxx", "h", "m", "mm", \
"hpp", "hx", "hxx", "ino", "java", "php", "php5", "go", "groovy", \
Expand Down