JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8175
  • Score
    100M100P100Q128347F
  • License MIT

Measure the churn/complexity ratio. Higher values mean hotspots where refactorings should happen.

Package Exports

  • code-complexity

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (code-complexity) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

code-complexity

Measure projects complexity based on files sloc and commit count.

Build Status Coverage Status Style Status NPM Version

Usage

$ npx code-complexity <path-to-git-directory>

Help

    Usage: code-complexity <dir> [options]
    
    Measure the churn/complexity ratio. Higher values mean hotspots where refactorings should happen.
    
    Options:
      -V, --version          output the version number
      --filter <strings>     list of globs (comma separated) to filter
      -f, --format [format]  format results using table or json
      -l, --limit [limit]    limit the number of files to output
      -i, --since [since]    limit the age of the commit analyzed
      -s, --sort [sort]      sort results (allowed valued: ratio,
                             churn, complexity or file)
      -h, --help             display help for command
    
    Examples:
    
    $ code-complexity <dir>
    $ code-complexity <dir> --limit 3
    $ code-complexity <dir> --sort ratio
    $ code-complexity <dir> --filter 'src/**','!src/front'
    $ code-complexity <dir> --limit 10 --sort ratio

Output

$ npx code-complexity . --sort=ratio --limit=3

┌──────────────────────────────┬────────────┬───────┬───────┐
│ file                         │ complexity │ churn │ ratio │
├──────────────────────────────┼────────────┼───────┼───────┤
│ src/cli.ts                   │ 1038824   │
├──────────────────────────────┼────────────┼───────┼───────┤
│ test/code-complexity.test.ts │ 1077749   │
├──────────────────────────────┼────────────┼───────┼───────┤
│ .idea/workspace.xml          │ 1236738   │
└──────────────────────────────┴────────────┴───────┴───────┘

Troubleshooting

  • Error: stdout maxBuffer exceeded: use the flag --since to limit the number of commits to analyze.