phodal/chapi

View on GitHub
chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt

Summary

Maintainability
D
2 days
Test Coverage

File JavaFullIdentListener.kt has 644 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

package chapi.ast.javaast

import chapi.ast.antlr.JavaParser
import chapi.domain.core.*
import chapi.infra.Stack

    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()

      Method warpTargetFullType has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private fun warpTargetFullType(targetType: String?): JavaTargetType {
              // first, parse from local type
              val callType: CallType = CallType.FUNCTION
              if (currentClz == targetType) {
                  return JavaTargetType(

        Method buildMethodCallMethodInfo has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private fun buildMethodCallMethodInfo(
                codeCall: CodeCall,
                callee: String = "",
                targetType: String?,
                ctx: JavaParser.MethodCallContext

          Method handleEmptyFullType has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private fun handleEmptyFullType(
                  ctx: JavaParser.MethodCallContext,
                  targetTypeObj: String,
                  methodName: String,
                  packageName: String

            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)

              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

                Avoid too many return statements within this method.
                Open

                                    return JavaTargetType(
                                        targetType = imp.Source,
                                        callType = CallType.SUPER
                                    )

                  Avoid too many return statements within this method.
                  Wontfix

                          return JavaTargetType(callType = callType)

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

                            if (ctx.STATIC() != null) {
                                val sourceSplit = codeImport.Source.split(".")
                                codeImport.UsageName = listOf(sourceSplit.last())
                    
                                val split = sourceSplit.dropLast(1)
                    chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaBasicIdentListener.kt on lines 20..26

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

                    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 enterEnumDeclaration(ctx: JavaParser.EnumDeclarationContext?) {
                            currentType = DataStructType.ENUM
                            currentNode.Type = currentType
                            currentNode.Position = buildPosition(ctx!!)
                    
                    
                    chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt on lines 82..92

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

                    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

                            } else {
                                currentType = DataStructType.CLASS
                                currentNode.Type = currentType
                                currentNode.Position = buildPosition(ctx!!)
                    
                    
                    chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt on lines 761..771

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

                    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/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

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

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

                    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

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

                            if (ctx!!.identifier() != null) {
                                currentClz = ctx.identifier().text
                                classNode.NodeName = currentClz
                            }
                    chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt on lines 104..107

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

                    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

                            if (ctx!!.identifier() != null) {
                                currentClz = ctx.identifier().text
                                classNode.NodeName = currentClz
                            }
                    chapi-ast-java/src/main/kotlin/chapi/ast/javaast/JavaFullIdentListener.kt on lines 786..789

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status