phodal/chapi

View on GitHub

Showing 388 of 390 total issues

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

    @Test
    fun shouldIdentAnnotation() {
        val code = """
using System; 
  

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

        @Test
        fun should_handle_multiple_datastruct() {
            val code = """
    package cc.unitmesh.pick.project
    
    

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

          override fun enterClassDeclaration(ctx: TypeScriptParser.ClassDeclarationContext?) {
              val nodeName = ctx!!.identifierName().text
      
              hasEnterClass = true
              currentNode = CodeDataStruct(

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

            @Test
            fun nested_type() {
                val code = """export type Query = Array<Array<Maybe<Number>>>"""
        
                TypeScriptAnalyser().analysis(code, "index.tsx")
        chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptRegressionTest.kt on lines 143..151

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

        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

                return CodePosition(
                    StartLine = ctx.start.line,
                    StartLinePosition = ctx.start.charPositionInLine,
                    StopLine = ctx.stop.line,
                    StopLinePosition = ctx.stop.charPositionInLine
        chapi-ast-python/src/main/kotlin/chapi/ast/pythonast/PythonAstBaseListener.kt on lines 73..78

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

        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

            @Test
            fun type_definition() {
                val code = """export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };"""
                TypeScriptAnalyser().analysis(code, "index.tsx")
        
        
        chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptRegressionTest.kt on lines 180..188

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

        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

                return CodePosition(
                    StartLine = ctx.start.line,
                    StartLinePosition = ctx.start.charPositionInLine,
                    StopLine = ctx.stop.line,
                    StopLinePosition = ctx.stop.charPositionInLine
        chapi-ast-c/src/main/kotlin/chapi/ast/cast/CAstBaseListener.kt on lines 13..18

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

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

            @Test
            fun shouldHandleIsIgnoreOrTest() {
                val emptyStringArray = listOf<AnnotationKeyValue>()
                val isComponent = CodeAnnotation("Ignore", emptyStringArray).isIgnoreOrTest()
                assertEquals(isComponent, true)
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 7..12
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 14..19
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 21..26
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 28..33

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

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

            @Test
            fun shouldHandleIsRepository() {
                val emptyStringArray = listOf<AnnotationKeyValue>()
                val isComponent = CodeAnnotation("Repository", emptyStringArray).isComponentOrRepository()
                assertEquals(isComponent, true)
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 14..19
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 21..26
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 28..33
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 35..40

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

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

            @Test
            fun shouldHandleIsComponent() {
                val emptyStringArray = listOf<AnnotationKeyValue>()
                val isComponent = CodeAnnotation("Component", emptyStringArray).isComponentOrRepository()
                assertEquals(isComponent, true)
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 7..12
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 21..26
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 28..33
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 35..40

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

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

            @Test
            fun shouldHandleIsTest() {
                val emptyStringArray = listOf<AnnotationKeyValue>()
                val isComponent = CodeAnnotation("Test", emptyStringArray).isTest()
                assertEquals(isComponent, true)
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 7..12
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 14..19
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 28..33
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 35..40

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

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

            @Test
            fun shouldHandleIsIgnore() {
                val emptyStringArray = listOf<AnnotationKeyValue>()
                val isComponent = CodeAnnotation("Ignore", emptyStringArray).isIgnore()
                assertEquals(isComponent, true)
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 7..12
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 14..19
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 21..26
        chapi-domain/src/test/kotlin/chapi/domain/core/CodeAnnotationTest.kt on lines 35..40

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

        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

            open fun parse(str: String): CParser =
                CharStreams.fromString(str)
                    .let(::CLexer)
                    .let(::CommonTokenStream)
                    .let(::CParser)
        Severity: Major
        Found in chapi-ast-c/src/main/kotlin/chapi/ast/cast/CAnalyser.kt and 1 other location - About 1 hr to fix
        chapi-ast-cpp/src/main/kotlin/chapi/ast/cppast/CPPAnalyser.kt on lines 65..69

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

        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

                            if ("define" == tokens[index + 1].text) {
                                // add to the conditional symbols
                                conditionalSymbol = tokens[index + 2].text
                                preprocessorParser.ConditionalSymbols.add(conditionalSymbol)
                            }
        chapi-ast-csharp/src/main/kotlin/chapi/ast/csharpast/CSharpAnalyser.kt on lines 75..78

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

        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

            open fun parse(str: String): CPP14Parser =
                CharStreams.fromString(str)
                    .let(::CPP14Lexer)
                    .let(::CommonTokenStream)
                    .let(::CPP14Parser)
        chapi-ast-c/src/main/kotlin/chapi/ast/cast/CAnalyser.kt on lines 75..79

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

        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

                            if ("undef" == tokens[index + 1].text) {
                                conditionalSymbol = tokens[index + 2].text
                                preprocessorParser.ConditionalSymbols.remove(conditionalSymbol)
                            }
        chapi-ast-csharp/src/main/kotlin/chapi/ast/csharpast/CSharpAnalyser.kt on lines 70..74

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

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

            fun buildMethodParameters(paramListCtx: TypeScriptParser.ParameterListContext?): List<CodeProperty> {
                var parameters: List<CodeProperty> = listOf()
        
                val type = paramListCtx!!.getChild(0)
                when (type.parent) {

          Method should_success_parse_test_usecase has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Test
              fun should_success_parse_test_usecase() {
                  val code = """
                  package cc.unitmesh.pick
          
          

            Method shouldIdentifyFirstFunctionCall has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Test
                fun shouldIdentifyFirstFunctionCall() {
                    val code = """
                        void aX(void);
                        int a1(int param1);

              Method parseParenthesizedExpression has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private fun parseParenthesizedExpression(context: ParenthesizedExpressionContext): List<CodeProperty> {
                      return context.expressionSequence().singleExpression().map { subSingle ->
                          var parameter = CodeProperty(TypeValue = "", TypeType = "object")
              
                          when (subSingle) {
                Severity
                Category
                Status
                Source
                Language