phodal/chapi

View on GitHub

Showing 85 of 390 total issues

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 {

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

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

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

        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

          Method should parse all field an message has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Test
              fun `should parse all field an message`() {
                  @Language("protobuf")
                  val protobufCode = """
          syntax = "proto3";

            File GoFullIdentListenerTest.kt has 251 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            package chapi.ast.goast
            
            import chapi.domain.core.DataStructType
            import org.junit.jupiter.api.Test
            import kotlin.test.assertEquals

              Method should_handle_actix_web_framework has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Test
                  fun should_handle_actix_web_framework() {
                      val code = """
                          use actix_web::{get, web, App, HttpServer, Responder};
                          

                Method enterClassSpecifier has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
                Open

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

                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

                Method enterVariableDeclaration has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    /**
                     *     create local var when new object
                     */
                    override fun enterVariableDeclaration(ctx: TypeScriptParser.VariableDeclarationContext?) {
                        if (ctx == null) {

                  Method shouldHandleForImportError has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Test
                      internal fun shouldHandleForImportError() {
                          val code = """
                  from dsp.utils import normalize_text
                  from dspy.primitives.prediction import Completions, Prediction

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

                          @Test
                          fun shouldHandleForMultipleMacroWithId() {
                              val code = """
                                  #define TEST_BEGIN(f)                            \
                                  static void                                \

                        Method should_handle_for_function_call has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Test
                            fun should_handle_for_function_call() {
                                val code = """
                                    use crate::domain::git::coco_tag::CocoTag;
                        
                        

                          Method should_handle_for_node_type_in_function_call has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Test
                              fun should_handle_for_node_type_in_function_call() {
                                  val code = """
                                      use std::sync::Arc;
                          
                          

                            Method shouldIdentifyMethodCall has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                @Test
                                fun shouldIdentifyMethodCall() {
                                    val code = """package main
                            
                            import (
                            Severity: Minor
                            Found in chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoMethodCallTest.kt - About 1 hr to fix

                              Method should identify class with fields has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      @Test
                                      internal fun `should identify class with fields`() {
                                          val code = """
                              package chapi.ast.kotlinast
                              
                              

                                Method constructMessageDef has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private fun constructMessageDef(ctx: Protobuf2Parser.MessageDefContext): CodeDataStruct {
                                        val messageName = ctx.messageName().text
                                        val codeDataStruct = CodeDataStruct(
                                            NodeName = messageName,
                                            Module = codeContainer.PackageName,

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

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

                                    Method constructMessageDef has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private fun constructMessageDef(ctx: Protobuf3Parser.MessageDefContext): CodeDataStruct {
                                            val messageName = ctx.messageName().text
                                            val codeDataStruct = CodeDataStruct(
                                                NodeName = messageName,
                                                Module = codeContainer.PackageName,

                                      Method enterFromBlock has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          override fun enterFromBlock(ctx: TypeScriptParser.FromBlockContext?) {
                                              val imp = unQuote(ctx!!.StringLiteral().text)
                                              val codeImport = CodeImport(
                                                  Source = imp
                                              )
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language