Showing 85 of 390 total issues
File TypeScriptFullIdentListenerTest.kt
has 1126 lines of code (exceeds 250 allowed). Consider refactoring. Open
package chapi.ast.typescriptast
import chapi.domain.core.DataStructType
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
File TypeScriptFullIdentListener.kt
has 818 lines of code (exceeds 250 allowed). Consider refactoring. Open
package chapi.ast.typescriptast
import chapi.ast.antlr.TypeScriptParser
import chapi.ast.antlr.TypeScriptParser.IdentifierExpressionContext
import chapi.ast.antlr.TypeScriptParser.ParenthesizedExpressionContext
Class TypeScriptFullIdentListenerTest
has 81 methods (exceeds 20 allowed). Consider refactoring. Open
internal class TypeScriptFullIdentListenerTest {
@Test
internal fun shouldIdentTypeScriptHelloWorldFunCall() {
val content = """
File CFullIdentListenerTest.kt
has 578 lines of code (exceeds 250 allowed). Consider refactoring. Open
package chapi.ast.cast
import chapi.domain.core.CodeContainer
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.collect
File RustFullIdentListenerTest.kt
has 532 lines of code (exceeds 250 allowed). Consider refactoring. Open
package chapi.ast.rustast
import chapi.domain.core.DataStructType
import org.junit.jupiter.api.Test
import java.io.File
Method parse
has a Cognitive Complexity of 62 (exceeds 20 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()
- Read upRead up
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
Class TypeScriptFullIdentListener
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class TypeScriptFullIdentListener(val node: TSIdentify) : TypeScriptAstListener() {
private var hasHtmlElement: Boolean = false
private var filePath: String = node.filePath
private var exitArrowCount: Int = 0
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()
File JavaFullIdentListenerTest.kt
has 386 lines of code (exceeds 250 allowed). Consider refactoring. Open
package chapi.ast.javaast
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
Class CFullIdentListenerTest
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
internal class CFullIdentListenerTest {
@Test
fun allGrammarUnderResources() {
val content = this::class.java.getResource("/grammar")!!.toURI()
File KotlinBasicIdentListenerTest.kt
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
package chapi.ast.kotlinast
import chapi.domain.core.DataStructType
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
File TypeScriptRegressionTest.kt
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
package chapi.ast.typescriptast
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import org.junit.jupiter.api.Disabled
Method handleStructOrUnion
has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring. Open
private fun handleStructOrUnion(ctx: CParser.StructOrUnionSpecifierContext?, nodeName: String) {
structMap.getOrPut(nodeName) {
CodeDataStruct(NodeName = nodeName, Position = buildPosition(ctx))
}.let {
currentDataStruct = it
- Read upRead up
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
Class GoFullIdentListener
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
/**
* core logic, please goto [GoFullIdentListener.enterExpression] to see how to use it
*/
class GoFullIdentListener(var fileName: String) : GoAstListener() {
private var codeContainer: CodeContainer = CodeContainer(FullName = fileName)
Method handleClassBodyElements
has a Cognitive Complexity of 39 (exceeds 20 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 -> {
- Read upRead up
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
File CSharpAstListenerTest.kt
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
package chapi.ast.csharpast
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
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()
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 = "";
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