Galooshi/import-js

View on GitHub

Showing 95 of 95 total issues

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

function fixImportsMessage(
  removedItems: Set<string>,
  addedItems: Set<string>,
): ?string {
  const messageParts = [];
Severity: Minor
Found in lib/Importer.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 importStatementStyle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function importStatementStyle(importStatement: ImportStatement): string {
  if (importStatement.hasSideEffects) {
    return STYLE_SIDE_EFFECT;
  }

Severity: Minor
Found in lib/ImportStatements.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 merge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  merge(importStatement: ImportStatement) {
    if (
      importStatement.defaultImport &&
      this.defaultImport !== importStatement.defaultImport
    ) {
Severity: Minor
Found in lib/ImportStatement.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 findESNamedExports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function findESNamedExports(node, { absolutePathToFile }) {
  if (node.type === 'ExportAllDeclaration') {
    // Recurse the file referenced by the declaration
    // eslint-disable-next-line no-use-before-define
    return resolveNestedNamedExports(node, absolutePathToFile);
Severity: Minor
Found in lib/findExports.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 _importStrings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  _importStrings(maxLineLength: number, tab: string): Array<string> {
    if (this.originalImportString) {
      return [this.originalImportString];
    }

Severity: Minor
Found in lib/ImportStatement.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

Avoid too many return statements within this function.
Open

    return strings;
Severity: Major
Found in lib/ImportStatement.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return STYLE_CUSTOM;
    Severity: Major
    Found in lib/ImportStatements.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return undefined;
      Severity: Major
      Found in lib/findCurrentImports.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return definedNames[right.name] || [];
        Severity: Major
        Found in lib/findExports.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return undefined;
          Severity: Major
          Found in lib/findCurrentImports.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return undefined;
            Severity: Major
            Found in lib/findCurrentImports.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return `./${rawPath}`;
              Severity: Major
              Found in lib/normalizePath.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return left.object.name === 'module' && left.property.name === 'exports';
                Severity: Major
                Found in lib/findExports.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return new ImportStatement({
                        declarationKeyword: node.kind,
                        defaultImport,
                        hasSideEffects: false,
                        importFunction: declaration.init.callee.name,
                  Severity: Major
                  Found in lib/findCurrentImports.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return [];
                    Severity: Major
                    Found in lib/findExports.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return false;
                      Severity: Major
                      Found in lib/findExports.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return undefined;
                        Severity: Major
                        Found in lib/findCurrentImports.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            return result;
                          Severity: Major
                          Found in lib/findExports.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return nestedNamed;
                            Severity: Major
                            Found in lib/findExports.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return [left.property.name];
                              Severity: Major
                              Found in lib/findExports.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language