Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cr2checkstyle

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cr2checkstyle

Convert complexity-report data to Checkstyle XML

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

cr2checkstyle

npm Travis CI Dependency Status devDependency Status node License

Convert complexity-report data to Checkstyle XML

This purpose of this command line tool is to convert the JSON output of complexity-report to Checkstyle-compatible XML.

Usage

cr2checkstyle reads from stdin and writes to stdout:

$ cr --format json --output report.json .
$ cr2checkstyle < report.json > report.xml

Or simply use piping:

$ cr --format json . | cr2checkstyle > report.xml

cr2checkstyle always terminates with an exit code of 0 (unless an internal error occurred), even if the generated checkstyle report contains items with severity "error". To change this behaviour use the --exit-code option.

Configuration

By default, cr2checkstyle has no thresholds set so it will not generate any warnings or errors. Currently supported metrics are cyclomatic complexity, halstead difficulty and the maintainability index. The corresponding command line options are:

  • module-maintainability
  • module-cyclomatic-complexity
  • function-cyclomatic-complexity
  • module-halstead-difficulty
  • function-halstead-difficulty

Thresholds are given as a low and high watermark. Values above the high watermark will cause errors, values between the low and high watermark will cause warnings (likewise for higher-is-better metrics such as the maintainability index):

# Check module-level maintainability index:
# 0-80 is an error, 80 to 90 is a warning, above 90 is ok
$ cr2checkstyle --module-maintainability 80,90

# Check function-level cyclomatic complexity:
# 0-2 is ok, 2-4 is a warning, above 4 is an error
$ cr2checkstyle --function-cyclomatic-complexity 2,4

Internally, parameters are parsed with yargs so you can also use environment variables (e.g., CR2CS_FUNCTION_HALSTEAD_DIFFICULTY=3,6) and the cr2checkstyle-property in your package.json.

Keywords

FAQs

Package last updated on 01 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc