tomokinakamaru/silverchain

View on GitHub

Showing 24 of 85 total issues

Generator has 55 methods (exceeds 20 allowed). Consider refactoring.
Open

public final class Generator {

  private final Diagrams diagrams;

  private final Javadocs javadocs;
Severity: Major
Found in src/main/java/silverchain/generator/Generator.java - About 7 hrs to fix

    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

        File Generator.java has 352 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package silverchain.generator;
        
        import static java.lang.String.join;
        import static java.util.Collections.emptyList;
        import static java.util.stream.Collectors.joining;
        Severity: Minor
        Found in src/main/java/silverchain/generator/Generator.java - About 4 hrs to fix

          File Tests.java has 285 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          package diagram;
          
          import static org.assertj.core.api.Assertions.assertThat;
          
          import java.io.ByteArrayInputStream;
          Severity: Minor
          Found in src/test/java/diagram/Tests.java - About 2 hrs to fix

            Javadocs has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public final class Javadocs {
            
              private final String path;
            
              private final WarningHandler handler;
            Severity: Minor
            Found in src/main/java/silverchain/javadoc/Javadocs.java - About 2 hrs to fix

              Method bulkTestData has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static Arguments[] bulkTestData() {
                  return new Arguments[] {
                    args(AgParser::qualifiedName, "foo"),
                    args(AgParser::qualifiedName, "foo.bar"),
                    args(AgParser::qualifiedName, "foo.bar.baz"),
              Severity: Major
              Found in src/test/java/parser/Tests.java - About 2 hrs to fix

                File Javadocs.java has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                package silverchain.javadoc;
                
                import static java.util.Arrays.stream;
                import static java.util.stream.Collectors.joining;
                
                
                Severity: Minor
                Found in src/main/java/silverchain/javadoc/Javadocs.java - About 2 hrs to fix

                  Method generateState has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private void generateState(State state) {
                      beginFile(getFilePath(getStateQualifiedName(state)));
                      writePackageDeclaration(getStatePackageName(state));
                  
                      // Class declaration
                  Severity: Minor
                  Found in src/main/java/silverchain/generator/Generator.java - About 1 hr to fix

                    Method generateIAction has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private void generateIAction(Diagram diagram) {
                        beginFile(getFilePath(getIActionQualifiedName(diagram)));
                        writePackageDeclaration(getIActionPackageName(diagram));
                    
                        // Interface declaration
                    Severity: Minor
                    Found in src/main/java/silverchain/generator/Generator.java - About 1 hr to fix

                      Method test12 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        @Test
                        void test12() {
                          test("Foo<T;S> { Qux bar(T t) baz(S s)*; }")
                              .name("Foo")
                              .typeParameterCount(2)
                      Severity: Minor
                      Found in src/test/java/diagram/Tests.java - About 1 hr to fix

                        Method importMap has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          public Map<String, QualifiedName> importMap() {
                            Map<String, QualifiedName> map = new HashMap<>();
                            if (importStatements().isPresent()) {
                              for (ImportStatement i : importStatements().get()) {
                                QualifiedName fullName = i.qualifiedName();
                        Severity: Minor
                        Found in src/main/java/silverchain/parser/Input.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

                        Method test11 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          @Test
                          void test11() {
                            test("Foo<T;S> { Qux<T,S> bar(T t) baz(S s); }")
                                .name("Foo")
                                .typeParameterCount(2)
                        Severity: Minor
                        Found in src/test/java/diagram/Tests.java - About 1 hr to fix

                          Method syntaxError has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                Recognizer<?, ?> recognizer,
                                Object offendingSymbol,
                                int line,
                                int charPositionInLine,
                                String msg,
                          Severity: Minor
                          Found in src/main/java/silverchain/parser/adapter/ParseErrorListener.java - About 45 mins to fix

                            Method syntaxError has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                  Recognizer<?, ?> recognizer,
                                  Object offendingSymbol,
                                  int line,
                                  int charPositionInLine,
                                  String msg,
                            Severity: Minor
                            Found in src/main/java/silverchain/parser/adapter/TokenizeErrorListener.java - About 45 mins to fix

                              Method getSignature has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                private String getSignature(MethodDeclaration declaration) {
                                  StringBuilder builder = new StringBuilder();
                                  builder.append(declaration.getNameAsString());
                                  builder.append("(");
                                  List<String> types = new ArrayList<>();
                              Severity: Minor
                              Found in src/main/java/silverchain/javadoc/Javadocs.java - About 35 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 getSignature has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                private static String getSignature(Method method) {
                                  StringBuilder builder = new StringBuilder();
                                  builder.append(method.name());
                                  builder.append("(");
                                  if (method.parameters().formalParameters().isPresent()) {
                              Severity: Minor
                              Found in src/main/java/silverchain/javadoc/Javadocs.java - About 35 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 loadComments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                private void loadComments(MethodDeclaration declaration) {
                                  String pkg = getPackageName(getCompilationUnit(declaration));
                              
                                  ClassOrInterfaceDeclaration decl = getClassOrInterfaceDeclaration(declaration);
                                  if (decl == null) {
                              Severity: Minor
                              Found in src/main/java/silverchain/javadoc/Javadocs.java - About 35 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

                              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

                                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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language