Galooshi/import-js

View on GitHub
lib/Configuration.js

Summary

Maintainability
A
3 hrs
Test Coverage
A
94%

Function mergedValue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function mergedValue(values: Array<any>, key: string, options: Object): any {
  let mergedResult;
  for (let i = 0; i < values.length; i += 1) {
    let value = values[i];
    if (typeof value === 'function') {
Severity: Minor
Found in lib/Configuration.js - 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

Function constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(
    pathToCurrentFile: string,
    workingDirectory: string = process.cwd(),
  ) {
    this.workingDirectory = workingDirectory;
Severity: Minor
Found in lib/Configuration.js - About 1 hr to fix

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

      loadLocalJsConfig(): ?Object {
        for (let i = 0; i < JS_CONFIG_FILES.length; i += 1) {
          const jsConfigFile = JS_CONFIG_FILES[i];
          const jsConfig = FileUtils.readJsFile(
            path.join(this.workingDirectory, jsConfigFile),
    Severity: Minor
    Found in lib/Configuration.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

    There are no issues that match your filters.

    Category
    Status