Skip to content

Commit 039b9cb

Browse files
author
Simon Renoult
committed
feat: add other complexity strategies
1 parent f696867 commit 039b9cb

File tree

14 files changed

+6497
-3699
lines changed

14 files changed

+6497
-3699
lines changed

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ $ npx code-complexity <path-to-git-directory or URL>
3232
Measure the churn/complexity score. Higher values mean hotspots where refactorings should happen.
3333
3434
Options:
35-
-V, --version output the version number
36-
--filter <strings> list of globs (comma separated) to filter
37-
-f, --format [format] format results using table, json or csv
38-
-l, --limit [limit] limit the number of files to output
39-
-i, --since [since] limit analysis to commits more recent in age than date
40-
-u, --until [until] limit analysis to commits older in age than date
41-
-s, --sort [sort] sort results (allowed valued: score,
42-
churn, complexity or file)
43-
-h, --help display help for command
35+
-V, --version output the version number
36+
--filter <strings> list of globs (comma separated) to filter
37+
-cs, --complexity-strategy [strategy] choose the complexity strategy to analyze your codebase with (allowed values: sloc, cyclomatic, halstead).
38+
-f, --format [format] format results using table, json or csv
39+
-l, --limit [limit] limit the number of files to output
40+
-i, --since [since] limit analysis to commits more recent in age than date
41+
-u, --until [until] limit analysis to commits older in age than date
42+
-s, --sort [sort] sort results (allowed valued: score, churn, complexity or file)
43+
-h, --help display help for command
4444
4545
Examples:
4646
@@ -50,10 +50,15 @@ $ npx code-complexity <path-to-git-directory or URL>
5050
$ code-complexity ../foo --sort score
5151
$ code-complexity /foo/bar --filter 'src/**,!src/front/**'
5252
$ code-complexity . --limit 10 --sort score
53+
$ code-complexity . --limit 10 --sort score -cs halstead
5354
$ code-complexity . --since=2021-06-01 --limit 100
5455
$ code-complexity . --since=2021-04-01 --until=2021-07-01
5556
```
5657

58+
## Notes
59+
60+
The Halstead metrics are a [collection of several metrics](https://en.wikipedia.org/wiki/Halstead_complexity_measures), we use the "volume" metric.
61+
5762
## Output
5863

5964
```sh
@@ -70,9 +75,11 @@ $ npx code-complexity https://github.com/simonrenoult/code-complexity --sort=sco
7075
└──────────────────────────────┴────────────┴───────┴───────┘
7176
```
7277

73-
## Troubleshooting
78+
## Special thanks
79+
80+
A special thanks to a few contributors that helped me make `code-complexity` better.
7481

75-
+ `Error: stdout maxBuffer exceeded`: use the flag `--since` to limit the number of commits to analyze.
82+
- Alexander Dormann (alexdo) for fixing the `ENOBUFS` (and apologies for stealing your code).
7683

7784
[michael-feathers-source]:https://www.stickyminds.com/article/getting-empirical-about-refactoring
7885
[travis-image]:https://img.shields.io/travis/simonrenoult/code-complexity/master.svg?style=flat-square
@@ -83,9 +90,3 @@ $ npx code-complexity https://github.com/simonrenoult/code-complexity --sort=sco
8390
[coverage-url]: https://codecov.io/gh/simonrenoult/code-complexity/branch/master
8491
[npm-image]: https://img.shields.io/npm/v/code-complexity.svg?style=flat-square
8592
[npm-url]: https://www.npmjs.com/package/code-complexity
86-
87-
## Special thanks
88-
89-
A special thanks to a few contributors that helped me make `code-complexity` better.
90-
91-
- Alexander Dormann (alexdo) for fixing the `ENOBUFS` (and apologies for stealing your code).

0 commit comments

Comments
 (0)