
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
java-complexity
Advanced tools
This tool approximates the [cyclomatic complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) of a snippet of Java code, based loosely on [these rules](https://www.leepoint.net/principles_and_practices/complexity/complexity-java-method.html).
This tool approximates the cyclomatic complexity of a snippet of Java code, based loosely on these rules.
const javaComplexity = require('java-complexity');
const input = `
void main() {
int number = 5;
double pi = 22.0 / 7.0;
if (number < 0) return;
switch (number) {
case 'a': break;
case 2: break;
case 5:
System.out.println("pi is " + (pi > 3 ? "higher" : "lower") + " than 3.");
break;
default: break;
}
}
`
const complexity = javaComplexity(input) // => { complexityValues: { main: 6 }, total: 6 }
When invoked from the command line, java-complexity reads input from stdin.
input is a string of Java code to process. suppressErrors is an optional flag that will suppress error logging. root is an optional (string) root grammar rule.
This function returns a map of method names to cyclomatic complexity values.
Unless root is specified, it attempts to parse the input as
If all of these fail, the function returns null.
java-complexity [-s] [input]
The -s flag suppresses error logging. If input is not provided as an argument, it is read from stdin. This program exits with code 1 if it fails to parse the input string.
FAQs
This tool approximates the [cyclomatic complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) of a snippet of Java code, based loosely on [these rules](https://www.leepoint.net/principles_and_practices/complexity/complexity-java-method.html).
The npm package java-complexity receives a total of 1 weekly downloads. As such, java-complexity popularity was classified as not popular.
We found that java-complexity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.