Showing 109 of 109 total issues

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

func (s *JavaRefactorListener) EnterAnnotation(ctx *AnnotationContext) {
    annotation := ctx.QualifiedName().GetText()

    startLine := ctx.GetStart().GetLine()
    stopLine := ctx.GetStop().GetLine()
Severity: Minor
Found in pkg/application/refactor/base/java_refactor_listener.go and 1 other location - About 55 mins to fix
pkg/application/refactor/base/java_refactor_listener.go on lines 121..127

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 126.

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

Function BuildDeps has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
Open

func BuildDeps(val xmlparse.XMLNode) []core_domain.CodeDependency {
    var deps []core_domain.CodeDependency = nil
    for _, depElement := range val.Elements {
        depNode := depElement.Val.(xmlparse.XMLNode)
        dependency := core_domain.NewCodeDependency("", "")
Severity: Minor
Found in pkg/application/deps/maven_analysis.go - 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 HandleSpaces has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected void HandleSpaces() {
        char next = (char) _input.LA(1);

        if ((_lastToken == null || _lastToken.getType() == PythonLexer.NEWLINE) && IsNotNewLineOrComment(next))
        {
Severity: Minor
Found in docs/compare/src/main/java/pyantlr/PythonBaseLexer.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

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

func TestTbsApp_RedundantPrintTest(t *testing.T) {
    g := NewGomegaWithT(t)
    codePath := "../../../_fixtures/tbs/usecases/RedundantPrintTest.java"
    codePath = filepath.FromSlash(codePath)

Severity: Minor
Found in pkg/application/tbs/tbs_app_test.go and 1 other location - About 50 mins to fix
pkg/application/tbs/tbs_app_test.go on lines 48..57

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 120.

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 2 locations. Consider refactoring.
Open

func TestTbsApp_SleepyTest(t *testing.T) {
    g := NewGomegaWithT(t)
    codePath := "../../../_fixtures/tbs/usecases/SleepyTest.java"
    codePath = filepath.FromSlash(codePath)

Severity: Minor
Found in pkg/application/tbs/tbs_app_test.go and 1 other location - About 50 mins to fix
pkg/application/tbs/tbs_app_test.go on lines 37..46

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 120.

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 2 locations. Consider refactoring.
Open

package cmd

import (
    "github.com/modernizing/coca/cocatest/testcase"
    "testing"
Severity: Minor
Found in cmd/call_test.go and 1 other location - About 50 mins to fix
cmd/count_test.go on lines 1..24

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 118.

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 2 locations. Consider refactoring.
Open

package cmd

import (
    "github.com/modernizing/coca/cocatest/testcase"
    "testing"
Severity: Minor
Found in cmd/count_test.go and 1 other location - About 50 mins to fix
cmd/call_test.go on lines 1..24

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 118.

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

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

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    func AnalysisJava() []core_domain.CodeDataStruct {
        importPath := analysisCmdConfig.Path
        identifierApp := javaapp.NewJavaIdentifierApp()
        iNodes := identifierApp.AnalysisPath(importPath)
    
    
    Severity: Minor
    Found in analysis/golang/app/analysis.go and 1 other location - About 45 mins to fix
    analysis/java/app/analysis.go on lines 36..48

    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 115.

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    func AnalysisJava() []core_domain.CodeDataStruct {
        importPath := analysisCmdConfig.Path
        identifierApp := javaapp.NewJavaIdentifierApp()
        iNodes := identifierApp.AnalysisPath(importPath)
    
    
    Severity: Minor
    Found in analysis/java/app/analysis.go and 1 other location - About 45 mins to fix
    analysis/golang/app/analysis.go on lines 40..52

    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 115.

    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

    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 BuildMethodCallExprStmt has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

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

        func TestApi(t *testing.T) {
            path := "../_fixtures/call"
        
            analysis := []testcase.CmdTestCase{{
                Name:   "analysis",
        Severity: Minor
        Found in cmd/api_test.go and 1 other location - About 45 mins to fix
        cmd/api_test.go on lines 26..42

        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 113.

        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 2 locations. Consider refactoring.
        Open

        func Test_ApiWithSortRemove(t *testing.T) {
            path := "../_fixtures/call"
        
            analysis := []testcase.CmdTestCase{{
                Name:   "analysis",
        Severity: Minor
        Found in cmd/api_test.go and 1 other location - About 45 mins to fix
        cmd/api_test.go on lines 8..24

        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 113.

        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

        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

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

            package cmd
            
            import (
                "github.com/modernizing/coca/cocatest/testcase"
                "testing"
            Severity: Major
            Found in cmd/concept_test.go and 3 other locations - About 40 mins to fix
            cmd/evaluate_test.go on lines 1..22
            cmd/rcall_test.go on lines 1..22
            cmd/suggest_test.go on lines 1..22

            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 109.

            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 4 locations. Consider refactoring.
            Open

            package cmd
            
            import (
                "github.com/modernizing/coca/cocatest/testcase"
                "testing"
            Severity: Major
            Found in cmd/evaluate_test.go and 3 other locations - About 40 mins to fix
            cmd/concept_test.go on lines 1..22
            cmd/rcall_test.go on lines 1..22
            cmd/suggest_test.go on lines 1..22

            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 109.

            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 4 locations. Consider refactoring.
            Open

            package cmd
            
            import (
                "github.com/modernizing/coca/cocatest/testcase"
                "testing"
            Severity: Major
            Found in cmd/rcall_test.go and 3 other locations - About 40 mins to fix
            cmd/concept_test.go on lines 1..22
            cmd/evaluate_test.go on lines 1..22
            cmd/suggest_test.go on lines 1..22

            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 109.

            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

            Severity
            Category
            Status
            Source
            Language