phodal/chapi

View on GitHub

Showing 388 of 390 total issues

Method should parse valid protobuf code with message in message and return a CodeContainer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    /// should support message in message
    @Test
    fun `should parse valid protobuf code with message in message and return a CodeContainer`() {
        // Given
        @Language("protobuf")

    Method should parse valid protobuf code with enum and return a CodeContainer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        /// should parse for enum
        @Test
        fun `should parse valid protobuf code with enum and return a CodeContainer`() {
            // Given
            @Language("protobuf")

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

              val code = """export class StatePipe implements PipeTransform {
        transform(state: Task): string {
          switch (state) {
            case Task.Created: {
              return '已创建';
      chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 154..170
      chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 1282..1295

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

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

              val code = """
      export default defineConfig({
        nodeModulesTransform: {
          type: "none",
          exclude: [],
      chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 154..170
      chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptRegressionTest.kt on lines 233..247

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

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

              val code = """
      interface IPerson {
          name: string;
      }
      
      
      chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 1282..1295
      chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptRegressionTest.kt on lines 233..247

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

      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

              val code = """
                  void aX(void);
                  int a1(int param1);
                  int a2(int param1, param2);
                  void a3();
      chapi-ast-c/src/test/kotlin/chapi/ast/cast/CFullIdentListenerTest.kt on lines 647..658

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

      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

              val code = """
                  #define Protect(x)    { L->savedpc = pc; {x;}; base = L->base; }
                  
                  void hello() {
                      Protect(luaV_gettable(L, &g, rb, ra));
      chapi-ast-c/src/test/kotlin/chapi/ast/cast/CFullIdentListenerTest.kt on lines 259..272

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

      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 toUml should return UML class representation for CodeDataStruct has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Test
          fun `toUml should return UML class representation for CodeDataStruct`() {
              // Given
              val codeDataStruct = CodeDataStruct(
                  NodeName = "TestClass",

        Method enterCreator has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            override fun enterCreator(ctx: JavaParser.CreatorContext?) {
                val variableName = ctx!!.getParent().getParent().getChild(0).text
                val allIdentifier = ctx.createdName().identifier()
                for (identifier in allIdentifier!!) {
                    val createdName = identifier.text

          Method enterServiceDef has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              override fun enterServiceDef(ctx: Protobuf2Parser.ServiceDefContext?) {
                  val dsName = ctx!!.serviceName().text
                  val functions: List<CodeFunction> = ctx.serviceElement()?.mapNotNull { context ->
                      if (context.rpc() == null) return@mapNotNull null
          
          

            Method enterClassSpecifier has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                override fun enterClassSpecifier(ctx: CPP14Parser.ClassSpecifierContext?) {
                    ctx?.classHead()?.let {
                        currentNode = CodeDataStruct()
            
                        it.classKey()?.let { keyContext ->

              Method should_inline_variable has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      @Test
                      internal fun should_inline_variable() {
                          val code = """
              package com.thoughtworks.archguard.packages.domain
                   

                Method enterServiceDef has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    override fun enterServiceDef(ctx: Protobuf3Parser.ServiceDefContext?) {
                        val dsName = ctx!!.serviceName().text
                        val functions: List<CodeFunction> = ctx.serviceElement()?.mapNotNull { context ->
                            if (context.rpc() == null) return@mapNotNull null
                
                

                  Method should parse valid protobuf code and return a CodeContainer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Test
                      fun `should parse valid protobuf code and return a CodeContainer`() {
                          // Given
                          @Language("protobuf")
                          val protobufCode = """

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

                        @Test
                        fun shouldNotCrashForGrammarFile() {
                            val code = this::class.java.getResource("/grammar/AllInOne8.java").readText()
                            JavaAnalyser().identFullInfo(code, "AllInOne8.java")
                        }
                    chapi-ast-csharp/src/test/kotlin/chapi/ast/csharpast/CSharpAstListenerTest.kt on lines 20..24
                    chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaIdentCallAppTest.kt on lines 7..11
                    chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaIdentCallAppTest.kt on lines 13..17
                    chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaIdentCallAppTest.kt on lines 19..23

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

                    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

                            val protobufCode = """
                    syntax = "proto2";
                    
                    package treelite;
                    
                    
                    chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/JsxTest.kt on lines 49..65

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

                    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

                            val content = """
                    const BadSmellThreshold = () => {
                        const renderRadio = (badSmellOption: BadSmellOption) => (
                            <Radio value={badSmellOption.id}
                                onClick={(e) => e.stopPropagation()}> 选择
                    chapi-ast-protobuf/src/test/kotlin/chapi/ast/protobuf/ProtobufRealWorldTest.kt on lines 106..120

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

                    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 shouldNotCrashForJava17() {
                            val code = this::class.java.getResource("/grammar/AllInOne17.java").readText()
                            JavaAnalyser().identFullInfo(code, "AllInOne8.java")
                        }
                    chapi-ast-csharp/src/test/kotlin/chapi/ast/csharpast/CSharpAstListenerTest.kt on lines 20..24
                    chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaFullIdentListenerTest.kt on lines 8..12
                    chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaIdentCallAppTest.kt on lines 7..11
                    chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaIdentCallAppTest.kt on lines 13..17

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

                    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

                        override fun exitEnumDeclaration(ctx: JavaParser.EnumDeclarationContext?) {
                            classNodeStack.pop()
                            if (classNodeStack.count() == 0) {
                                this.exitBody()
                            } else {
                    chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt on lines 131..138

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

                    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 shouldNotCrashForJava11() {
                            val code = this::class.java.getResource("/grammar/AllInOne11.java").readText()
                            JavaAnalyser().identFullInfo(code, "AllInOne8.java")
                        }
                    chapi-ast-csharp/src/test/kotlin/chapi/ast/csharpast/CSharpAstListenerTest.kt on lines 20..24
                    chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaFullIdentListenerTest.kt on lines 8..12
                    chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaIdentCallAppTest.kt on lines 7..11
                    chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaIdentCallAppTest.kt on lines 19..23

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

                    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