phodal/chapi

View on GitHub

Showing 362 of 364 total issues

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

    @Test
    internal fun shouldBuildMemberId_WhenSameFileIdPackageName() {
        var nodes: List<CodeFunction> = listOf()
        val codeFunction = CodeFunction(Name = "Builder", IsConstructor = false)
        nodes += codeFunction
chapi-domain/src/test/kotlin/chapi/domain/core/CodeMemberTest.kt on lines 23..38

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

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

Class JavaFullIdentListenerTest has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

class JavaFullIdentListenerTest {

    @Test
    fun shouldNotCrashForGrammarFile() {
        val code = this::class.java.getResource("/grammar/AllInOne8.java").readText()

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

        @Test
        internal fun shouldIdentifyRequireImport() {
            val code = """
    import zip = require("./ZipCodeValidator");
    
    
    chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 225..236

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

    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 shouldIdentifyBlockImportsSource() {
            val code = """
    import { ZipCodeValidator } from "./ZipCodeValidator";
    
    
    chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 253..264

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

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

        private fun handleClassMember(memberCtx: CSharpParser.Class_member_declarationContext?) {
            val memberDeclaration = memberCtx!!.common_member_declaration() ?: return
            val firstChild = memberDeclaration.getChild(0) ?: return
    
            var returnType = "";

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

          @Test
          internal fun queryBeforeIdentify() {
              val code = """
      export const switchFunc = (pagination, filters, sorter, {action}) => {
        switch (action) {
      chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/JsxTest.kt on lines 179..196

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

      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 commentInTsx() {
              val code = """
      export function BuGrade(props: BuGradeProps) {
        return (
      chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 958..975

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

      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 64 lines of code (exceeds 25 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()
      
      

        File GoFullIdentListener.kt has 273 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package chapi.ast.goast
        
        import chapi.ast.antlr.GoParser
        import chapi.domain.core.*
        import chapi.infra.Stack
        Severity: Minor
        Found in chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt - About 2 hrs to fix

          Class TypeScriptRegressionTest has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class TypeScriptRegressionTest {
          
              @Test
              internal fun reggrestion1() {
                  val code = """

            Class RustFullIdentListenerTest has 23 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class RustFullIdentListenerTest {
                @Test
                fun should_success_handle_for_rust_structure_node_def() {
                    val str = """
                        struct Point {

              Method handleClassBodyElements has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private fun handleClassBodyElements(classTailCtx: TypeScriptParser.ClassBodyContext) {
                      for (clzElementCtx in classTailCtx.classMemberList().classMember()) {
                          val childCtx = clzElementCtx.getChild(0) ?: continue
                          when (childCtx) {
                              is TypeScriptParser.ConstructorDeclarationContext -> {

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

                            codeContainer.DataStructures[0].Functions[1].run {
                                assertEquals(Annotations[0].Name, "GetMapping")
                                assertEquals(Annotations[0].KeyValues[0].Key, "value")
                                assertEquals(Annotations[0].KeyValues[0].Value, "\"/{name}/dependencies\"")
                
                
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/spring/KotlinSpringCompatibleTest.kt on lines 138..142
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/spring/KotlinSpringCompatibleTest.kt on lines 143..147

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

                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

                            codeContainer.DataStructures[0].Functions[2].run {
                                assertEquals(Annotations[0].Name, "GetMapping")
                                assertEquals(Annotations[0].KeyValues[0].Key, "value")
                                assertEquals(Annotations[0].KeyValues[0].Value, "\"/{name}/invokes\"")
                            }
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/spring/KotlinSpringCompatibleTest.kt on lines 132..137
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/spring/KotlinSpringCompatibleTest.kt on lines 143..147

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

                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

                            codeContainer.DataStructures[0].Functions[3].run {
                                assertEquals(Annotations[0].Name, "GetMapping")
                                assertEquals(Annotations[0].KeyValues[0].Key, "value")
                                assertEquals(Annotations[0].KeyValues[0].Value, "\"/{name}/methods_callees\"")
                            }
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/spring/KotlinSpringCompatibleTest.kt on lines 132..137
                chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/spring/KotlinSpringCompatibleTest.kt on lines 138..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 168.

                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 KotlinFullIdentListenerTest.kt has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                package chapi.ast.kotlinast
                
                import chapi.domain.core.CallType
                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 supportForExprInFunction() {
                          val code = """
                  function PluginConfig(props: { data: ConfigData; updateData: Function }) {
                      return (
                  chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListenerTest.kt on lines 1031..1046

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

                  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 lodashIssueInObjectMethod() {
                          val code = """
                  export default function CouplingList(props: CouplingListProps) {
                    const props = firstItem.props.map((prop, index) => {
                  chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/JsxTest.kt on lines 158..176

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

                  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 shouldIdentDeclNameSpace() {
                          val code = """
                  using System; 
                    
                  chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaBasicIdentListenerTest.kt on lines 229..241

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

                  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].Fields[3].run {
                                  assertEquals(TypeType, "kotlin.IntValue")
                                  assertEquals(TypeValue, "0")
                                  assertEquals(TypeKey, "weight")
                                  assertEquals(Modifiers[0], "private")
                  chapi-ast-kotlin/src/test/kotlin/chapi/ast/kotlinast/KotlinBasicIdentListenerTest.kt on lines 259..265

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

                  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