OtherDevOpsGene/zap-sonar-plugin

View on GitHub

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;
Severity: Minor
Found in src/main/java/org/sonar/zaproxy/parser/element/AlertItem.java - About 4 hrs to fix

    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();
    Severity: Major
    Found in src/main/java/org/sonar/zaproxy/parser/ReportParser.java - About 2 hrs to fix

      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);
      
      
      Severity: Minor
      Found in scripts/start.js - About 1 hr to fix

        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());
        Severity: Minor
        Found in src/main/java/org/sonar/zaproxy/parser/element/AlertItem.java - About 1 hr to fix

          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:") +
          Severity: Minor
          Found in scripts/start.js - About 1 hr to fix

            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 {
            Severity: Minor
            Found in src/main/java/org/sonar/zaproxy/rule/ZapRuleDefinition.java - About 1 hr to fix

            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) => {
            Severity: Minor
            Found in scripts/build.js - About 1 hr to fix

              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) {
              Severity: Minor
              Found in src/main/java/org/sonar/zaproxy/parser/ReportParser.java - About 1 hr to fix

                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 {
                Severity: Minor
                Found in src/main/java/org/sonar/zaproxy/ZapSensor.java - About 1 hr to fix

                  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();
                  Severity: Minor
                  Found in src/main/java/org/sonar/zaproxy/parser/ReportParser.java - About 55 mins to fix

                  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) {
                  Severity: Minor
                  Found in src/main/java/org/sonar/zaproxy/parser/ReportParser.java - About 25 mins to fix

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language