ember-cli/ember-cli

View on GitHub
lib/models/package-info-cache/index.js

Summary

Maintainability
D
2 days
Test Coverage
A
95%

Function _readPackage has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  _readPackage(packageDir, pkg, isRoot) {
    let normalizedPackageDir = path.normalize(packageDir);

    // Most of the time, normalizedPackageDir is already a real path (i.e. fs.realpathSync
    // will return the same value as normalizedPackageDir if the dir actually exists).
Severity: Minor
Found in lib/models/package-info-cache/index.js - About 5 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

Function _readPackage has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _readPackage(packageDir, pkg, isRoot) {
    let normalizedPackageDir = path.normalize(packageDir);

    // Most of the time, normalizedPackageDir is already a real path (i.e. fs.realpathSync
    // will return the same value as normalizedPackageDir if the dir actually exists).
Severity: Major
Found in lib/models/package-info-cache/index.js - About 3 hrs to fix

Function _readNodeModulesList has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _readNodeModulesList(nodeModulesDir) {
    let normalizedNodeModulesDir = path.normalize(nodeModulesDir);

    // Much of the time, normalizedNodeModulesDir is already a real path (i.e.
    // fs.realpathSync will return the same value as normalizedNodeModulesDir, if
Severity: Minor
Found in lib/models/package-info-cache/index.js - About 1 hr to fix

Function _showObjErrors has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _showObjErrors(obj) {
    let errorEntries = obj.hasErrors() ? obj.errors.getErrors() : null;

    if (!errorEntries || (errorEntries.length === 1 && errorEntries[0].type === Errors.ERROR_PACKAGE_DIR_MISSING)) {
      return;
Severity: Minor
Found in lib/models/package-info-cache/index.js - About 1 hr to fix

Function _readNodeModulesList has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  _readNodeModulesList(nodeModulesDir) {
    let normalizedNodeModulesDir = path.normalize(nodeModulesDir);

    // Much of the time, normalizedNodeModulesDir is already a real path (i.e.
    // fs.realpathSync will return the same value as normalizedNodeModulesDir, if
Severity: Minor
Found in lib/models/package-info-cache/index.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 _showObjErrors has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  _showObjErrors(obj) {
    let errorEntries = obj.hasErrors() ? obj.errors.getErrors() : null;

    if (!errorEntries || (errorEntries.length === 1 && errorEntries[0].type === Errors.ERROR_PACKAGE_DIR_MISSING)) {
      return;
Severity: Minor
Found in lib/models/package-info-cache/index.js - About 55 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 _findPackage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  _findPackage(packageName, startPath) {
    let parsedPath = path.parse(startPath);
    let root = parsedPath.root;

    let currPath = startPath;
Severity: Minor
Found in lib/models/package-info-cache/index.js - About 45 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