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

jscheckstyle

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jscheckstyle

Static analysis tool for javascript - calculates cyclomatic complexity, amongst other things

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

Purpose

A command-line tool for analysing javascript source, providing measurements of function length, number of arguments, and cyclomatic complexity.

Installation

For now, you'll have to just clone this repo, but soon this will work: npm install jscheckstyle

Usage

jscheckstyle some-javascript.js some-other-javascript.js (default output as nice table on command line)
jscheckstyle --violations some-javascript.js (will output rule-violating functions only)
jscheckstyle --html some-javascript.js > output.html
jscheckstyle --json some-javascript.js > output.json
jscheckstyle --checkstyle some-javascript.js > output.xml (will output Java checkstyle-compatible output, useful for Jenkins)

Rules

There are three rules at the moment which will be violated if:

  • function length is greater than 30 lines
  • number of arguments to a function is greater than 5
  • cyclomatic complexity for a function is greater than 10

TODO

  • Configurable rules (maybe you like functions that are longer or shorter)

History

Originally I started out modifying jsmeter to run as a command-line tool. Then I started hacking away, added some tests, the command-line interface, added the rules checking and the extra output types, replaced the parser with node-burrito and then realised there wasn't much of jsmeter left. So this tool is inspired by, and owes a huge debt to, jsmeter - but there's very little of the original code to be found (possibly only the HTML output renderer).

Keywords

FAQs

Package last updated on 15 Sep 2011

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