phodal/chapi

View on GitHub

Showing 73 of 364 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

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

                              Method should identify method with parameters and return type has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      @Test
                                      internal fun `should identify method with parameters and return type`() {
                                          val code = """
                              package chapi.ast.kotlinast
                              
                              

                                Method shouldHandleForMacroForBrokenCondition has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    @Test
                                    fun shouldHandleForMacroForBrokenCondition() {
                                        val code = """
                                            static const ctl_named_node_t stats_mutexes_node[] = {
                                            #define OP(mtx) {NAME(#mtx), CHILD(named, stats_mutexes_##mtx)},

                                  Method shouldIdentifyCreator has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      @Test
                                      fun shouldIdentifyCreator() {
                                          val code = """
                                  package cc.arduino.packages.contributions;
                                  
                                  

                                    Method enterArrowFunctionDeclaration has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        // see also in function declaration
                                        override fun enterArrowFunctionDeclaration(ctx: TypeScriptParser.ArrowFunctionDeclarationContext?) {
                                            isCallbackOrAnonymousFunction = false
                                    
                                            when (val grad = ctx?.parent?.parent) {

                                      Method shouldSuccessHandleDs has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          @Test
                                          fun shouldSuccessHandleDs() {
                                              val code = """
                                                  // https://stackoverflow.com/questions/12642830/can-i-define-a-function-inside-a-c-structure
                                                  #include <stdio.h>
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language