jasonwyatt/KWasm

View on GitHub

Showing 6 of 39 total issues

Method parseModule has a Cognitive Complexity of 76 (exceeds 20 allowed). Consider refactoring.
Open

/**
 * Parses a [WasmModule] from the receiving [List] of [Token]s.
 *
 * From [the docs](https://webassembly.github.io/spec/core/text/modules.html#text-module):
 *
Severity: Minor
Found in library/src/main/java/kwasm/format/text/module/WasmModule.kt - About 1 day to fix

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 ValidationContext has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
Open

/** Given a [WasmModule], creates a new [ValidationContext]. */
fun ValidationContext(module: WasmModule): ValidationContext.Module {
    val types = MutableAstNodeIndex<Type>()
    val functions = MutableAstNodeIndex<TypeUse>()
    val tables = MutableAstNodeIndex<TableType>()
Severity: Minor
Found in library/src/main/java/kwasm/validation/ValidationContext.kt - About 3 hrs to fix

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 parseLiteral has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
Open

/** Parses a [Literal] of type [T] from the receiving [List] of [Token]s at the given position. */
@OptIn(ExperimentalUnsignedTypes::class)
fun <T : Any> List<Token>.parseLiteral(
    fromIndex: Int,
    asClass: KClass<T>
Severity: Minor
Found in library/src/main/java/kwasm/format/text/Literal.kt - About 3 hrs to fix

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 parseStringChar has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
Open

@OptIn(ExperimentalUnsignedTypes::class)
fun IntArray.parseStringChar(
    index: Int,
    inoutVal: StringChar = StringChar(),
    context: ParseContext? = null
Severity: Minor
Found in library/src/main/java/kwasm/format/text/token/util/Utils.kt - About 2 hrs to fix

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 indexAfterBlockComment has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
Open

    private fun indexAfterBlockComment(
        sequence: CharSequence,
        startIndex: Int,
        context: ParseContext? = null
    ): Int {
Severity: Minor
Found in library/src/main/java/kwasm/format/text/whitespace/Comment.kt - About 1 hr to fix

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 parseInstructions has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
Open

/**
 * Parses a [List] of [Instruction]s from the [Token]s.
 *
 * Throws [ParseException] if fewer than [min] are found, and returns at most [max].
 */
Severity: Minor
Found in library/src/main/java/kwasm/format/text/instruction/Instruction.kt - About 1 hr to fix

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

Severity
Category
Status
Source
Language