Showing 85 of 390 total issues
Method should parse valid protobuf code and return a CodeContainer
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Test
fun `should parse valid protobuf code and return a CodeContainer`() {
// Given
@Language("protobuf")
val protobufCode = """
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 createFunction
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
returnType: String,
annotations: List<CodeAnnotation>,
packageName: String,
modifiers: List<String>,
methodName: String,
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
Avoid too many return
statements within this method. Open
Open
return JavaTargetType(
targetType = imp.Source,
callType = CallType.SUPER
)