phodal/chapi

View on GitHub

Showing 362 of 364 total issues

File TypeScriptFullIdentListenerTest.kt has 1126 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package chapi.ast.typescriptast

import chapi.domain.core.DataStructType
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json

    File TypeScriptFullIdentListener.kt has 818 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package chapi.ast.typescriptast
    
    import chapi.ast.antlr.TypeScriptParser
    import chapi.ast.antlr.TypeScriptParser.IdentifierExpressionContext
    import chapi.ast.antlr.TypeScriptParser.ParenthesizedExpressionContext

      Class TypeScriptFullIdentListenerTest has 81 methods (exceeds 20 allowed). Consider refactoring.
      Open

      internal class TypeScriptFullIdentListenerTest {
      
          @Test
          internal fun shouldIdentTypeScriptHelloWorldFunCall() {
              val content = """

        File CFullIdentListenerTest.kt has 578 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package chapi.ast.cast
        
        import chapi.domain.core.CodeContainer
        import kotlinx.coroutines.flow.asFlow
        import kotlinx.coroutines.flow.collect
        Severity: Major
        Found in chapi-ast-c/src/test/kotlin/chapi/ast/cast/CFullIdentListenerTest.kt - About 1 day to fix

          File RustFullIdentListenerTest.kt has 532 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          package chapi.ast.rustast
          
          import chapi.domain.core.DataStructType
          import org.junit.jupiter.api.Test
          import java.io.File

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

                    @Test
                    internal fun `should identify function call of creator after main`() {
                        val code = """
            package chapi.ast.kotlinast
                
            chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinFullIdentListenerTest.kt on lines 33..61

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

            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 `should identify function call of creator`() {
                        val code = """
            package chapi.ast.kotlinast
                 
            chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinFullIdentListenerTest.kt on lines 63..91

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

            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 parse has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
            Open

                // based on: https://gist.github.com/KvanTTT/d95579de257531a3cc15
                private fun parse(str: String): CSharpParser {
                    val codeTokens: MutableList<Token> = mutableListOf()
                    val commentTokens: MutableList<Token> = mutableListOf()
            
            

            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

            Class TypeScriptFullIdentListener has 49 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class TypeScriptFullIdentListener(val node: TSIdentify) : TypeScriptAstListener() {
                private var hasHtmlElement: Boolean = false
                private var filePath: String = node.filePath
            
                private var exitArrowCount: Int = 0

              Class JavaFullIdentListener has 47 methods (exceeds 20 allowed). Consider refactoring.
              Open

              open class JavaFullIdentListener(fileName: String, val classes: List<String>) : JavaAstListener() {
                  private var isEnterFunction: Boolean = false
                  private var currentAnnotations: List<CodeAnnotation> = listOf()
              
                  private var currentCreatorNode: CodeDataStruct = CodeDataStruct()

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

                        @Test
                        internal fun `should identify function call of imported function`() {
                            val code = """
                package chapi.ast.kotlinast
                     
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinFullIdentListenerTest.kt on lines 93..117
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinFullIdentListenerTest.kt on lines 119..142

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

                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

                        @Test
                        internal fun `should identify function call of depended class`() {
                            val code = """
                package chapi.ast.kotlinast
                     
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinFullIdentListenerTest.kt on lines 119..142
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinFullIdentListenerTest.kt on lines 144..167

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

                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

                        @Test
                        internal fun `should identify function call of imported object`() {
                            val code = """
                package chapi.ast.kotlinast
                     
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinFullIdentListenerTest.kt on lines 93..117
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinFullIdentListenerTest.kt on lines 144..167

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

                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

                File JavaFullIdentListenerTest.kt has 386 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                package chapi.ast.javaast
                
                import org.junit.jupiter.api.Test
                import kotlin.test.assertEquals
                
                

                  Class CFullIdentListenerTest has 33 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  internal class CFullIdentListenerTest {
                  
                      @Test
                      fun allGrammarUnderResources() {
                          val content = this::class.java.getResource("/grammar")!!.toURI()
                  Severity: Minor
                  Found in chapi-ast-c/src/test/kotlin/chapi/ast/cast/CFullIdentListenerTest.kt - About 4 hrs to fix

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

                        @Test
                        fun should_identify_self_function_call() {
                            val code = """
                                use crate::{Document, Embedding};
                                
                    chapi-ast-rust/src/test/kotlin/chapi/ast/rustast/RustFullIdentListenerTest.kt on lines 213..232

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

                    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 should_identify_function_call_with_method() {
                            val code = """
                                use crate::Point;
                                
                    chapi-ast-rust/src/test/kotlin/chapi/ast/rustast/RustFullIdentListenerTest.kt on lines 234..253

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

                    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

                    File KotlinBasicIdentListenerTest.kt has 335 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    package chapi.ast.kotlinast
                    
                    import chapi.domain.core.DataStructType
                    import org.junit.jupiter.api.Nested
                    import org.junit.jupiter.api.Test

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

                          @Test
                          internal fun shouldIdentifyStructPropertyName() {
                              val code = """
                      struct list_el {
                         int val;
                      chapi-ast-scala/src/test/kotlin/chapi/ast/scalaast/ScalaFullIdentListenerTest.kt on lines 39..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 249.

                      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 shouldIdentClassParameters() {
                              val code = """
                      class Outer(i : IntValue) {
                        def foo(x : Inner.type) = x.getI
                      chapi-ast-c/src/test/kotlin/chapi/ast/cast/CFullIdentListenerTest.kt on lines 81..94

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

                      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