Showing 73 of 364 total issues
Method codeCallFromExprList
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private fun codeCallFromExprList(primaryExprCtx: GoParser.PrimaryExprContext): CodeCall {
return when (val child = primaryExprCtx.getChild(0)) {
is GoParser.OperandContext -> {
CodeCall(NodeName = child.text)
}
Method parseParenthesizedExpression
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private fun parseParenthesizedExpression(context: ParenthesizedExpressionContext): List<CodeProperty> {
return context.expressionSequence().singleExpression().map { subSingle ->
var parameter = CodeProperty(TypeValue = "", TypeType = "object")
when (subSingle) {
Method buildMethodParameters
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fun buildMethodParameters(paramListCtx: TypeScriptParser.ParameterListContext?): List<CodeProperty> {
var parameters: List<CodeProperty> = listOf()
val type = paramListCtx!!.getChild(0)
when (type.parent) {
Method should_success_parse_test_usecase
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Test
fun should_success_parse_test_usecase() {
val code = """
package cc.unitmesh.pick
Method shouldIdentifyFirstFunctionCall
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Test
fun shouldIdentifyFirstFunctionCall() {
val code = """
void aX(void);
int a1(int param1);
Method toUml should return UML class representation for CodeDataStruct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Test
fun `toUml should return UML class representation for CodeDataStruct`() {
// Given
val codeDataStruct = CodeDataStruct(
NodeName = "TestClass",
Method enterCreator
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method should_inline_variable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Test
internal fun should_inline_variable() {
val code = """
package com.thoughtworks.archguard.packages.domain
Method enterClassSpecifier
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
override fun enterClassSpecifier(ctx: CPP14Parser.ClassSpecifierContext?) {
ctx?.classHead()?.let {
currentNode = CodeDataStruct()
it.classKey()?.let { keyContext ->
Consider simplifying this complex logical expression. Open
Open
if ("line" == directiveStr || "error" == directiveStr || "warning" == directiveStr || "define" == directiveStr || "endregion" == directiveStr || "endif" == directiveStr || "pragma" == directiveStr) {
compiledTokens = true
}
Method enterFromBlock
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
Open
override fun enterFromBlock(ctx: TypeScriptParser.FromBlockContext?) {
val imp = unQuote(ctx!!.StringLiteral().text)
val codeImport = CodeImport(
Source = imp
)
- 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
Method createFunction
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
returnType: String,
annotations: List<CodeAnnotation>,
packageName: String,
modifiers: List<String>,
methodName: String,
Avoid too many return
statements within this method. Open
Open
return JavaTargetType(
targetType = imp.Source,
callType = CallType.SUPER
)