Showing 39 of 109 total issues

Method ProcessStringLiteral has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected void ProcessStringLiteral()
    {
        if (lastToken == null || lastToken.getType() == TypeScriptLexer.OpenBrace)
        {
            String text = getText();
Severity: Minor
Found in docs/compare/src/main/java/tsantlr/TypeScriptBaseLexer.java - About 45 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

Function BuildMethodCall has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

func BuildMethodCall(codeFunc *CodeFunction, item ast.Stmt, fields []CodeField, localVars []CodeProperty, imports []CodeImport, packageName string) ([]CodeProperty, CodeCall) {
Severity: Minor
Found in pkg/infrastructure/ast/ast_go/cocago_builder.go - About 45 mins to fix

    Function GetFilesWithFilter has 6 return statements (exceeds 4 allowed).
    Open

    func GetFilesWithFilter(codeDir string, filter func(path string) bool) []string {
        files := make([]string, 0)
        gitIgnore, err := ignore.CompileIgnoreFile(filepath.FromSlash(codeDir + "/.gitignore"))
        if err != nil {
            fmt.Println(err)
    Severity: Major
    Found in pkg/adapter/cocafile/file_analysis_helper.go - About 40 mins to fix

      Function WarpTargetFullType has 6 return statements (exceeds 4 allowed).
      Open

      func WarpTargetFullType(targetType string) (string, string) {
          callType := ""
          if strings.EqualFold(currentClz, targetType) {
              callType = "self"
              return currentPkg + "." + targetType, callType
      Severity: Major
      Found in pkg/infrastructure/ast/ast_java/ast_java_target_handler.go - About 40 mins to fix

        Method FullGraph.buildGraphNode has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (fullGraph *FullGraph) buildGraphNode(subgraph string, current *PathTrie, graph *gographviz.Graph, nodes map[string]string, s string) {
        Severity: Minor
        Found in pkg/application/arch/tequila/incl_viz.go - About 35 mins to fix

          Function checkAssert has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func checkAssert(hasAssert bool, filePath string, method core_domain.CodeFunction, results *[]TestBadSmell, testType *string) {
          Severity: Minor
          Found in pkg/application/tbs/tbs_app.go - About 35 mins to fix

            Function CommonAnalysis has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func CommonAnalysis(output io.Writer, path string, app app_concept.AbstractAnalysisApp, filter func(path string) bool, isFunctionBase bool) []core_domain.CodeDataStruct {
            Severity: Minor
            Found in pkg/application/analysis/common_analysis.go - About 35 mins to fix

              Function checkDuplicateAssertTest has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func checkDuplicateAssertTest(clz core_domain.CodeDataStruct, results *[]TestBadSmell, methodCallMap map[string][]core_domain.CodeCall, method core_domain.CodeFunction, testType *string) {
              Severity: Minor
              Found in pkg/application/tbs/tbs_app.go - About 35 mins to fix

                Function checkSleepyTest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func checkSleepyTest(path string, call core_domain.CodeCall, jMethod core_domain.CodeFunction, results *[]TestBadSmell, testType *string) {
                Severity: Minor
                Found in pkg/application/tbs/tbs_app.go - About 35 mins to fix

                  Function checkRedundantAssertionTest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func checkRedundantAssertionTest(path string, call core_domain.CodeCall, method core_domain.CodeFunction, results *[]TestBadSmell, testType *string) {
                  Severity: Minor
                  Found in pkg/application/tbs/tbs_app.go - About 35 mins to fix

                    Function checkEmptyTest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func checkEmptyTest(path string, annotation core_domain.CodeAnnotation, results *[]TestBadSmell, method core_domain.CodeFunction, testType *string) {
                    Severity: Minor
                    Found in pkg/application/tbs/tbs_app.go - About 35 mins to fix

                      Function warpTargetFullType has 5 return statements (exceeds 4 allowed).
                      Open

                      func warpTargetFullType(targetType string) string {
                          if strings.EqualFold(currentClz, targetType) {
                              return currentPkg + "." + targetType
                          }
                      
                      
                      Severity: Major
                      Found in pkg/infrastructure/ast/bs_java/bad_smell_listener.go - About 35 mins to fix

                        Function CopyFile has 5 return statements (exceeds 4 allowed).
                        Open

                        func CopyFile(src, dst string) (int64, error) {
                            sourceFileStat, err := os.Stat(src)
                            if err != nil {
                                return 0, err
                            }
                        Severity: Major
                        Found in pkg/application/refactor/moveclass/move_class_app.go - About 35 mins to fix

                          Function compare has 5 return statements (exceeds 4 allowed).
                          Open

                          func compare(actual []byte, filename string) error {
                              if err := update(filename, actual); err != nil {
                                  return err
                              }
                          
                          
                          Severity: Major
                          Found in cocatest/cmd_assert.go - About 35 mins to fix

                            Function BuildExpr has 5 return statements (exceeds 4 allowed).
                            Open

                            func BuildExpr(expr ast.Expr) (string, string, string) {
                                switch x := expr.(type) {
                                case *ast.SelectorExpr:
                                    selector := ""
                                    switch sele := x.X.(type) {
                            Severity: Major
                            Found in pkg/infrastructure/ast/ast_go/cocago_parser.go - About 35 mins to fix

                              Function SegmentCamelcase has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                              Open

                              func SegmentCamelcase(methodsName []string) map[string]int {
                                  strMap = make(map[string]int)
                                  for _, name := range methodsName {
                                      // get, set
                                      if (strings.HasSuffix("set", name) || strings.HasSuffix("get", name)) && len(name) > 3 {
                              Severity: Minor
                              Found in pkg/application/concept/concept_segmenter.go - 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 ProcessNewLine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private void ProcessNewLine(int indent) {
                                      emit(PythonLexer.LINE_BREAK);
                              
                                      int previous = _indents.size() == 0 ? 0 : _indents.peek();
                              
                              
                              Severity: Minor
                              Found in docs/compare/src/main/java/pyantlr/PythonBaseLexer.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

                              Method JavaAPIListener.EnterAnnotation has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                              Open

                              func (s *JavaAPIListener) EnterAnnotation(ctx *parser.AnnotationContext) {
                                  if ctx.QualifiedName() == nil {
                                      return
                                  }
                              
                              
                              Severity: Minor
                              Found in pkg/infrastructure/ast/ast_java/ast_api_java/java_api_listener.go - 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

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

                                  protected boolean lineTerminatorAhead() {
                              
                                      // Get the token ahead of the current index.
                                      int possibleIndexEosToken = this.getCurrentToken().getTokenIndex() - 1;
                                      Token ahead = _input.get(possibleIndexEosToken);
                              Severity: Minor
                              Found in docs/compare/src/main/java/tsantlr/TypeScriptBaseParser.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