phodal/chapi

View on GitHub

Showing 73 of 364 total issues

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

    private fun handleStructOrUnion(ctx: CParser.StructOrUnionSpecifierContext?, nodeName: String) {
        structMap.getOrPut(nodeName) {
            CodeDataStruct(NodeName = nodeName, Position = buildPosition(ctx))
        }.let {
            currentDataStruct = it
Severity: Minor
Found in chapi-ast-c/src/main/kotlin/chapi/ast/cast/CFullIdentListener.kt - About 1 hr to fix

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

        // call from method invocation parent will be easy to search for method call
        override fun enterMethod_invocation(ctx: CSharpParser.Method_invocationContext?) {
            val parent = ctx?.parent ?: return
            val primaryExpr = when (parent) {
                is CSharpParser.Primary_expressionContext -> {

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

            @Test
            fun should_handle_for_marco_call() {
                val code = """
                    fn test_init_semantic() {
                        let model = std::fs::read("../model/model.onnx").unwrap();

          Method should inline variable to parameter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  @Test
                  internal fun `should inline variable to parameter`() {
                      val code = """
          package com.thoughtworks.archguard.packages.domain
               

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

                @Test
                fun should_pass_for_multiple_impl() {
                    val str = """
                        use std::cmp::Ordering;
                        use crate::embedding::Embedding;

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

                  @Test
                  fun should_success_build_position_for_testing() {
                      val testCode = """
                         use std::sync::Arc;
              
              

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

                      private fun parseArguments(argument: TypeScriptParser.ArgumentsExpressionContext): List<CodeProperty> {
                          var params = listOf<CodeProperty>()
                  
                          // for: `axios<Module[]>({parameter}).then`
                          // create then and update parameter

                    Method bodyHashShouldReturnFalseWhenMethodHasBeenChangeInTheNextCommit has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Test
                        fun bodyHashShouldReturnFalseWhenMethodHasBeenChangeInTheNextCommit() {
                            val oldCode = """
                                package chapi.ast.javaast;
                    
                    

                      Method enterVariableStatement has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          override fun enterVariableStatement(ctx: VariableStatementContext?) {
                              val isExport = ctx!!.parent.parent.getChild(0).text == "export"
                      
                              if (!isExport && ctx.variableDeclarationList() != null) {
                                  defaultNode.Fields = variableToFields(ctx.variableDeclarationList())

                        Method analysis should return CodeContainer with correct field count 3 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Test
                            fun `analysis should return CodeContainer with correct field count 3`() {
                                // given
                                val tomlCode = """
                                    [database]

                          Method bodyHashShouldReturnTrueWhenIdentifyTheSameCode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Test
                              fun bodyHashShouldReturnTrueWhenIdentifyTheSameCode() {
                                  val oldCode = """
                                      package chapi.ast.javaast;
                          
                          

                            Method shouldHandleMacroInFunc has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                @Test
                                fun shouldHandleMacroInFunc() {
                                    val code = """
                                        void os_pages_unmap(void *addr, size_t size) {
                                            assert(ALIGNMENT_ADDR2BASE(addr, os_page) == addr);

                              Method allGrammarUnderResources has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  @Test
                                  fun allGrammarUnderResources() {
                                      val content = this::class.java.getResource("/grammar")!!.toURI()
                              //        val content = "/Users/phodal/Downloads/redis-unstable/deps/lua"
                                      val totalStart = System.currentTimeMillis()

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

                                      override fun enterClassDeclaration(ctx: TypeScriptParser.ClassDeclarationContext?) {
                                          val nodeName = ctx!!.identifierName().text
                                  
                                          hasEnterClass = true
                                          currentNode = CodeDataStruct(

                                    Method codeCallFromExprList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private fun codeCallFromExprList(primaryExprCtx: GoParser.PrimaryExprContext): CodeCall {
                                            return when (val child = primaryExprCtx.getChild(0)) {
                                                is GoParser.OperandContext -> {
                                                    CodeCall(NodeName = child.text)
                                                }
                                    Severity: Minor
                                    Found in chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt - About 1 hr to fix

                                      Method shouldIdentAnnotation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          @Test
                                          fun shouldIdentAnnotation() {
                                              val code = """
                                      using System; 
                                        

                                        Method variableToField has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            private fun variableToField(
                                                it: TypeScriptParser.VariableDeclarationContext,
                                                modifiers: List<String>
                                            ): CodeField {
                                                val key = it.getChild(0).text
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language