phodal/chapi

View on GitHub

Showing 388 of 390 total issues

Method enterVariableStatement has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    override fun enterVariableStatement(ctx: VariableStatementContext?) {
        val isExport = ctx!!.parent.parent.getChild(0).text == "export"

        if (!isExport && ctx.variableDeclarationList() != null) {
            defaultNode.Fields = variableToFields(ctx.variableDeclarationList())

    Method parseArguments has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private fun parseArguments(argument: TypeScriptParser.ArgumentsExpressionContext): List<CodeProperty> {
            var params = listOf<CodeProperty>()
    
            // for: `axios<Module[]>({parameter}).then`
            // create then and update parameter

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

              val str = """
                  struct Point {
                      x: i32,
                      y: i32,
                  }
      chapi-ast-rust/src/test/kotlin/chapi/ast/rustast/RustFullIdentListenerTest.kt on lines 568..577

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

      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 = """
                  fn test_init_semantic() {
                      let model = std::fs::read("../model/model.onnx").unwrap();
                      let tokenizer_data = std::fs::read("../model/tokenizer.json").unwrap();
      
      
      chapi-ast-rust/src/test/kotlin/chapi/ast/rustast/RustFullIdentListenerTest.kt on lines 50..66

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

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

          private fun constructEnum(child: Protobuf3Parser.EnumDefContext): CodeDataStruct {
              val name = child.enumName().text
              val enumDs = CodeDataStruct(
                  NodeName = name,
                  Type = DataStructType.ENUM,

        Method bodyHashShouldReturnFalseWhenMethodHasBeenChangeInTheNextCommit has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Test
            fun bodyHashShouldReturnFalseWhenMethodHasBeenChangeInTheNextCommit() {
                val oldCode = """
                    package chapi.ast.javaast;
        
        

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

                  val codeFunction = CodeFunction(
                      Name = name,
                      ReturnType = typeType,
                      Position = buildPosition(ctx),
                      IsConstructor = false,
          chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaBasicIdentListener.kt on lines 96..102

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

          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

                  val codeFunction = CodeFunction(
                      Name = name,
                      ReturnType = typeType,
                      Position = buildPosition(ctx),
                      IsConstructor = false,
          chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt on lines 192..198

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

          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

                  codeContainer.DataStructures[0].Functions[0].run {
                      assertEquals(IsConstructor, false)
                      assertEquals(Name, "calculateCircleArea")
                      assertEquals(ReturnType, "kotlin.Double")
                  }
          chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinBasicIdentListenerTest.kt on lines 187..191

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

          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

                      codeContainer.DataStructures[0].Functions[1].run {
                          assertEquals(IsConstructor, false)
                          assertEquals(Name, "sayHello")
                          assertEquals(ReturnType, "kotlin.Unit")
                      }
          chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinBasicIdentListenerTest.kt on lines 253..257

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

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

              @Test
              fun bodyHashShouldReturnTrueWhenIdentifyTheSameCode() {
                  val oldCode = """
                      package chapi.ast.javaast;
          
          

            Method allGrammarUnderResources has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Test
                fun allGrammarUnderResources() {
                    val content = this::class.java.getResource("/grammar")!!.toURI()
            //        val content = "/Users/phodal/Downloads/redis-unstable/deps/lua"
                    val totalStart = System.currentTimeMillis()

              Method shouldHandleMacroInFunc has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Test
                  fun shouldHandleMacroInFunc() {
                      val code = """
                          void os_pages_unmap(void *addr, size_t size) {
                              assert(ALIGNMENT_ADDR2BASE(addr, os_page) == addr);

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

                    @Test
                    internal fun multipleGeneric() {
                        val code = """
                const createTreeNode = <U = TreeNode, T extends JavaItem<T>>(): U => {};
                """
                chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 1086..1093

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

                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
                    internal fun keyofTypeOf() {
                        val code = """
                const getClazzColumnsBy = (type: keyof typeof columnCount) => {}
                """
                chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 1300..1307

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

                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

                    class AssignOp(val lhs: ExpressionNode, val op: AssignOpKind, val rhs: ExpressionNode) : ExpressionNode {
                        override fun toString(): String = "$lhs $op $rhs"
                    }
                chapi-domain/src/main/kotlin/chapi/domain/expr/Expression.kt on lines 15..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 98.

                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

                    class ComparisonOp(val lhs: ExpressionNode, val op: ComparisonOpKind, val rhs: ExpressionNode) : ExpressionNode {
                        override fun toString(): String = "$lhs $op $rhs"
                    }
                chapi-domain/src/main/kotlin/chapi/domain/expr/Expression.kt on lines 19..21

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

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

                    private fun variableToField(
                        it: TypeScriptParser.VariableDeclarationContext,
                        modifiers: List<String>
                    ): CodeField {
                        val key = it.getChild(0).text

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

                      private fun codeCallFromExprList(primaryExprCtx: GoParser.PrimaryExprContext): CodeCall {
                          return when (val child = primaryExprCtx.getChild(0)) {
                              is GoParser.OperandContext -> {
                                  CodeCall(NodeName = child.text)
                              }
                  Severity: Minor
                  Found in chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt - About 1 hr to fix

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

                        override fun enterFieldDeclaration(ctx: JavaParser.FieldDeclarationContext?) {
                            super.enterFieldDeclaration(ctx)
                    
                            val declarators = ctx!!.variableDeclarators()
                            val typeType = declarators.parent.getChild(0)
                      Severity
                      Category
                      Status
                      Source
                      Language