tomokinakamaru/silverchain

View on GitHub
src/main/java/silverchain/parser/adapter/ASTBuilder.java

Summary

Maintainability
F
3 days
Test Coverage
A
96%

ASTBuilder has 52 methods (exceeds 20 allowed). Consider refactoring.
Open

public final class ASTBuilder extends AgBaseVisitor<ASTNode> {

  private final Map<String, RuleExpression> fragments = new HashMap<>();

  @Override
Severity: Major
Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java - About 7 hrs to fix

    File ASTBuilder.java has 420 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package silverchain.parser.adapter;
    
    import java.util.HashMap;
    import java.util.Map;
    import org.antlr.v4.runtime.Token;
    Severity: Minor
    Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java - About 6 hrs to fix

      Avoid too many return statements within this method.
      Open

            return visitRepeatOperatorNM(ctx.repeatOperatorNM());
      Severity: Major
      Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return visitRepeatOperatorNX(ctx.repeatOperatorNX());
        Severity: Major
        Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java - About 30 mins to fix

          Method visitRepeatOperator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            @Override
            public RepeatOperator visitRepeatOperator(AgParser.RepeatOperatorContext ctx) {
              if (ctx.repeatOperator0X() != null) {
                return visitRepeatOperator0X(ctx.repeatOperator0X());
              }
          Severity: Minor
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.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

          Define and throw a dedicated exception instead of using a generic one.
          Open

              throw new RuntimeException();

          Using such generic exceptions as Error, RuntimeException, Throwable, and Exception prevents calling methods from handling true, system-generated exceptions differently than application-generated errors.

          Noncompliant Code Example

          public void foo(String bar) throws Throwable {  // Noncompliant
            throw new RuntimeException("My Message");     // Noncompliant
          }
          

          Compliant Solution

          public void foo(String bar) {
            throw new MyOwnRuntimeException("My Message");
          }
          

          Exceptions

          Generic exceptions in the signatures of overriding methods are ignored, because overriding method has to follow signature of the throw declaration in the superclass. The issue will be raised on superclass declaration of the method (or won't be raised at all if superclass is not part of the analysis).

          @Override
          public void myMethod() throws Exception {...}
          

          Generic exceptions are also ignored in the signatures of methods that make calls to methods that throw generic exceptions.

          public void myOtherMethod throws Exception {
            doTheThing();  // this method throws Exception
          }
          

          See

          Define and throw a dedicated exception instead of using a generic one.
          Open

              throw new RuntimeException();

          Using such generic exceptions as Error, RuntimeException, Throwable, and Exception prevents calling methods from handling true, system-generated exceptions differently than application-generated errors.

          Noncompliant Code Example

          public void foo(String bar) throws Throwable {  // Noncompliant
            throw new RuntimeException("My Message");     // Noncompliant
          }
          

          Compliant Solution

          public void foo(String bar) {
            throw new MyOwnRuntimeException("My Message");
          }
          

          Exceptions

          Generic exceptions in the signatures of overriding methods are ignored, because overriding method has to follow signature of the throw declaration in the superclass. The issue will be raised on superclass declaration of the method (or won't be raised at all if superclass is not part of the analysis).

          @Override
          public void myMethod() throws Exception {...}
          

          Generic exceptions are also ignored in the signatures of methods that make calls to methods that throw generic exceptions.

          public void myOtherMethod throws Exception {
            doTheThing();  // this method throws Exception
          }
          

          See

          Define and throw a dedicated exception instead of using a generic one.
          Open

              throw new RuntimeException();

          Using such generic exceptions as Error, RuntimeException, Throwable, and Exception prevents calling methods from handling true, system-generated exceptions differently than application-generated errors.

          Noncompliant Code Example

          public void foo(String bar) throws Throwable {  // Noncompliant
            throw new RuntimeException("My Message");     // Noncompliant
          }
          

          Compliant Solution

          public void foo(String bar) {
            throw new MyOwnRuntimeException("My Message");
          }
          

          Exceptions

          Generic exceptions in the signatures of overriding methods are ignored, because overriding method has to follow signature of the throw declaration in the superclass. The issue will be raised on superclass declaration of the method (or won't be raised at all if superclass is not part of the analysis).

          @Override
          public void myMethod() throws Exception {...}
          

          Generic exceptions are also ignored in the signatures of methods that make calls to methods that throw generic exceptions.

          public void myOtherMethod throws Exception {
            doTheThing();  // this method throws Exception
          }
          

          See

          Define and throw a dedicated exception instead of using a generic one.
          Open

              throw new RuntimeException();

          Using such generic exceptions as Error, RuntimeException, Throwable, and Exception prevents calling methods from handling true, system-generated exceptions differently than application-generated errors.

          Noncompliant Code Example

          public void foo(String bar) throws Throwable {  // Noncompliant
            throw new RuntimeException("My Message");     // Noncompliant
          }
          

          Compliant Solution

          public void foo(String bar) {
            throw new MyOwnRuntimeException("My Message");
          }
          

          Exceptions

          Generic exceptions in the signatures of overriding methods are ignored, because overriding method has to follow signature of the throw declaration in the superclass. The issue will be raised on superclass declaration of the method (or won't be raised at all if superclass is not part of the analysis).

          @Override
          public void myMethod() throws Exception {...}
          

          Generic exceptions are also ignored in the signatures of methods that make calls to methods that throw generic exceptions.

          public void myOtherMethod throws Exception {
            doTheThing();  // this method throws Exception
          }
          

          See

          Define and throw a dedicated exception instead of using a generic one.
          Open

              throw new RuntimeException();

          Using such generic exceptions as Error, RuntimeException, Throwable, and Exception prevents calling methods from handling true, system-generated exceptions differently than application-generated errors.

          Noncompliant Code Example

          public void foo(String bar) throws Throwable {  // Noncompliant
            throw new RuntimeException("My Message");     // Noncompliant
          }
          

          Compliant Solution

          public void foo(String bar) {
            throw new MyOwnRuntimeException("My Message");
          }
          

          Exceptions

          Generic exceptions in the signatures of overriding methods are ignored, because overriding method has to follow signature of the throw declaration in the superclass. The issue will be raised on superclass declaration of the method (or won't be raised at all if superclass is not part of the analysis).

          @Override
          public void myMethod() throws Exception {...}
          

          Generic exceptions are also ignored in the signatures of methods that make calls to methods that throw generic exceptions.

          public void myOtherMethod throws Exception {
            doTheThing();  // this method throws Exception
          }
          

          See

          Define and throw a dedicated exception instead of using a generic one.
          Open

              throw new RuntimeException();

          Using such generic exceptions as Error, RuntimeException, Throwable, and Exception prevents calling methods from handling true, system-generated exceptions differently than application-generated errors.

          Noncompliant Code Example

          public void foo(String bar) throws Throwable {  // Noncompliant
            throw new RuntimeException("My Message");     // Noncompliant
          }
          

          Compliant Solution

          public void foo(String bar) {
            throw new MyOwnRuntimeException("My Message");
          }
          

          Exceptions

          Generic exceptions in the signatures of overriding methods are ignored, because overriding method has to follow signature of the throw declaration in the superclass. The issue will be raised on superclass declaration of the method (or won't be raised at all if superclass is not part of the analysis).

          @Override
          public void myMethod() throws Exception {...}
          

          Generic exceptions are also ignored in the signatures of methods that make calls to methods that throw generic exceptions.

          public void myOtherMethod throws Exception {
            doTheThing();  // this method throws Exception
          }
          

          See

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public FormalParameters visitFormalParameterList(AgParser.FormalParameterListContext ctx) {
              FormalParameter p = visitFormalParameter(ctx.formalParameter());
              FormalParameters ps = null;
              if (ctx.formalParameterList() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public RuleExpression visitRuleExpression(AgParser.RuleExpressionContext ctx) {
              RuleTerm t = visitRuleTerm(ctx.ruleTerm());
              RuleExpression e = null;
              if (ctx.ruleExpression() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public TypeReferences visitExceptionList(AgParser.ExceptionListContext ctx) {
              TypeReference r = visitTypeReference(ctx.typeReference());
              TypeReferences rs = null;
              if (ctx.exceptionList() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public TypeParameterList visitTypeParameterList(AgParser.TypeParameterListContext ctx) {
              TypeParameter p = visitTypeParameter(ctx.typeParameter());
              TypeParameterList ps = null;
              if (ctx.typeParameterList() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public TypeArguments visitTypeArgumentList(AgParser.TypeArgumentListContext ctx) {
              TypeArgument a = visitTypeArgument(ctx.typeArgument());
              TypeArguments as = null;
              if (ctx.typeArgumentList() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public RuleFactor visitRuleFactor(AgParser.RuleFactorContext ctx) {
              RuleElement e = visitRuleElement(ctx.ruleElement());
              RepeatOperator o = null;
              if (ctx.repeatOperator() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public Rules visitRuleStatements(AgParser.RuleStatementsContext ctx) {
              Rule r = visitRuleStatement(ctx.ruleStatement());
              Rules rs = null;
              if (ctx.ruleStatements() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public RuleExpressions visitRuleExpressionList(AgParser.RuleExpressionListContext ctx) {
              RuleExpression e = visitRuleExpression(ctx.ruleExpression());
              RuleExpressions es = null;
              if (ctx.ruleExpressionList() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public Type visitClassDeclarationHead(AgParser.ClassDeclarationHeadContext ctx) {
              QualifiedName n = visitQualifiedName(ctx.qualifiedName());
              TypeParameters ps = null;
              if (ctx.classTypeParameterDeclarations() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public Rule visitRuleStatement(AgParser.RuleStatementContext ctx) {
              RuleExpression e = visitRuleExpression(ctx.ruleExpression());
              TypeReference r = null;
              if (ctx.typeReference() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public ImportStatements visitAliasDeclarations(AgParser.AliasDeclarationsContext ctx) {
              ImportStatement i = visitAliasDeclaration(ctx.aliasDeclaration());
              ImportStatements is = null;
              if (ctx.aliasDeclarations() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public RuleTerm visitRuleTerm(AgParser.RuleTermContext ctx) {
              RuleFactor f = visitRuleFactor(ctx.ruleFactor());
              RuleTerm t = null;
              if (ctx.ruleTerm() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 78..86
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 13 locations. Consider refactoring.
          Open

            @Override
            public Grammars visitClassDeclarations(AgParser.ClassDeclarationsContext ctx) {
              Grammar g = visitClassDeclaration(ctx.classDeclaration());
              Grammars gs = null;
              if (ctx.classDeclarations() != null) {
          Severity: Major
          Found in src/main/java/silverchain/parser/adapter/ASTBuilder.java and 12 other locations - About 55 mins to fix
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 45..53
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 102..110
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 146..154
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 156..164
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 166..174
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 176..184
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 186..194
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 233..241
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 331..339
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 354..362
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 364..372
          src/main/java/silverchain/parser/adapter/ASTBuilder.java on lines 411..419

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status