mediv0/v-bucket

View on GitHub

Showing 2 of 2 total issues

Function searchNestedModules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function searchNestedModules(path, bucket) {
    // if the path already calculated. there is no need to do it again
    const _nodes = (isPathAlreadyCalculated(path) && path) || parsePath(path);
    let _lastModuleName = "root";
    // if the user just provide a name but not a valid path, we return the root instance
Severity: Minor
Found in src/helpers.js - About 35 mins 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

Function interceptGetters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    interceptGetters(_self, _target) {
        // finding correct getter recursively from root to bottom
        return new Proxy(_target, {
            get(target, prop) {
                const _path = parsePath(prop);
Severity: Minor
Found in src/bucket.js - About 25 mins 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