fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/parser/differ/MethodChangeUpdateCondition.java

Summary

Maintainability
C
1 day
Test Coverage

Method calculateFileDiffs has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    protected boolean calculateFileDiffs(GraphModel model, GraphMatcher matches, Match match) {
        Method oldMethod = (Method) match.getMatch();
        Method newMethod = (Method) match.getOtherMatch().getMatch();

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 calculateModelDiffs has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    protected boolean calculateModelDiffs(GraphModel model, GraphMatcher matches, Match match) {
        Method oldMethod = (Method) match.getOtherMatch().getMatch();
        Method newMethod = (Method) match.getMatch();

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 calculateModelDiffs has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    protected boolean calculateModelDiffs(GraphModel model, GraphMatcher matches, Match match) {
        Method oldMethod = (Method) match.getOtherMatch().getMatch();
        Method newMethod = (Method) match.getMatch();

    Method calculateFileDiffs has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        protected boolean calculateFileDiffs(GraphModel model, GraphMatcher matches, Match match) {
            Method oldMethod = (Method) match.getMatch();
            Method newMethod = (Method) match.getOtherMatch().getMatch();
    
    

      Avoid using a branching statement as the last in a loop.
      Open

                      break;

      AvoidBranchingStatementAsLastInLoop

      Since: PMD 5.0

      Priority: Medium High

      Categories: Style

      Remediation Points: 50000

      Using a branching statement as the last part of a loop may be a bug, and/or is confusing. Ensure that the usage is not a bug, or consider using another approach.

      Example:

      // unusual use of branching statement in a loop
      for (int i = 0; i < 10; i++) {
       if (i*i <= 25) {
       continue;
       }
       break;
      }
      
      // this makes more sense...
      for (int i = 0; i < 10; i++) {
       if (i*i > 25) {
       break;
       }
      }

      These nested if statements could be combined
      Open

                          if (oldParameter.getType().equals(newParameter.getType()) == false) {
                              continue;
                          }

      CollapsibleIfStatements

      Since: PMD 3.1

      Priority: Medium

      Categories: Style

      Remediation Points: 50000

      Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

      Example:

      void bar() {
       if (x) { // original implementation
       if (y) {
       // do stuff
       }
       }
      }
      
      void bar() {
       if (x && y) { // optimized implementation
       // do stuff
       }
      }

      Avoid using a branching statement as the last in a loop.
      Open

                      break;

      AvoidBranchingStatementAsLastInLoop

      Since: PMD 5.0

      Priority: Medium High

      Categories: Style

      Remediation Points: 50000

      Using a branching statement as the last part of a loop may be a bug, and/or is confusing. Ensure that the usage is not a bug, or consider using another approach.

      Example:

      // unusual use of branching statement in a loop
      for (int i = 0; i < 10; i++) {
       if (i*i <= 25) {
       continue;
       }
       break;
      }
      
      // this makes more sense...
      for (int i = 0; i < 10; i++) {
       if (i*i > 25) {
       break;
       }
      }

      There are no issues that match your filters.

      Category
      Status