Showing 11 of 26 total issues
AlertItem
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
public class AlertItem {
private int pluginid;
private String alert;
private int riskcode;
Method processAlertItem
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private AlertItem processAlertItem(SMInputCursor alertItemCursor) throws XMLStreamException {
AlertItem alertItem = new AlertItem();
SMInputCursor childCursor = alertItemCursor.childCursor();
while (childCursor.getNext() != null) {
String nodeName = childCursor.getLocalName();
Function setupCompiler
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setupCompiler(host, port, protocol) {
// "Compiler" is a low-level interface to Webpack.
// It lets us listen to some events and provide our own custom messages.
compiler = webpack(config, handleCompile);
Method toString
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public String toString() {
StringBuilder instanceString = new StringBuilder();
for (Instance instance : instances) {
instanceString.append(instance.toString());
Function onProxyError
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onProxyError(proxy) {
return function(err, req, res) {
const host = req.headers && req.headers.host;
console.log(
chalk.red("Proxy error:") +
Method loadDefaultZAProxyRules
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private void loadDefaultZAProxyRules(NewRepository repository) {
xmlLoader.load(
repository, getClass().getResourceAsStream(ZapPlugin.RULES_FILE), StandardCharsets.UTF_8);
for (NewRule newRule : repository.rules()) {
try {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function build
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function build() {
console.log(chalk.cyan.bold("Creating optimized production build..."));
console.log();
webpack(config, (err, stats) => {
Method processInstance
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Instance processInstance(SMInputCursor childInstanceCursor) throws XMLStreamException {
Instance instance = new Instance();
while (childInstanceCursor.getNext() != null) {
String instanceNodeName = childInstanceCursor.getLocalName();
if (instanceNodeName != null) {
Method execute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void execute(SensorContext context) {
Profiler profiler = Profiler.create(LOGGER);
profiler.startInfo("Process ZAP report");
try {
Method processAlertItem
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private AlertItem processAlertItem(SMInputCursor alertItemCursor) throws XMLStreamException {
AlertItem alertItem = new AlertItem();
SMInputCursor childCursor = alertItemCursor.childCursor();
while (childCursor.getNext() != null) {
String nodeName = childCursor.getLocalName();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method processInstance
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private Instance processInstance(SMInputCursor childInstanceCursor) throws XMLStreamException {
Instance instance = new Instance();
while (childInstanceCursor.getNext() != null) {
String instanceNodeName = childInstanceCursor.getLocalName();
if (instanceNodeName != null) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"