ember-cli/ember-cli

View on GitHub
lib/models/per-bundle-addon-cache/addon-proxy.js

Summary

Maintainability
C
1 day
Test Coverage
B
81%

Function getAddonProxy has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

function getAddonProxy(targetCacheEntry, parent) {
  let _app;

  // handle `preprocessJs` separately for Embroider
  //
Severity: Minor
Found in lib/models/per-bundle-addon-cache/addon-proxy.js - About 4 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 getAddonProxy has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getAddonProxy(targetCacheEntry, parent) {
  let _app;

  // handle `preprocessJs` separately for Embroider
  //
Severity: Major
Found in lib/models/per-bundle-addon-cache/addon-proxy.js - About 2 hrs to fix

Function get has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    get(targetCacheEntry, property) {
      if (property === 'parent') {
        return parent;
      }

Severity: Minor
Found in lib/models/per-bundle-addon-cache/addon-proxy.js - About 1 hr to fix

Avoid too many return statements within this function.
Open

      return Reflect.get(targetCacheEntry, property);
Severity: Major
Found in lib/models/per-bundle-addon-cache/addon-proxy.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return function _originalAddonPropMethodWrapper() {
            let originalReturnValue = targetCacheEntry[TARGET_INSTANCE][property](...arguments);

            if (property === 'cacheKeyForTree') {
              const treeType = arguments[0];
Severity: Major
Found in lib/models/per-bundle-addon-cache/addon-proxy.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return [];
Severity: Major
Found in lib/models/per-bundle-addon-cache/addon-proxy.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return Reflect.get(targetCacheEntry[TARGET_INSTANCE], property);
Severity: Major
Found in lib/models/per-bundle-addon-cache/addon-proxy.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return () => undefined;
Severity: Major
Found in lib/models/per-bundle-addon-cache/addon-proxy.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return targetCacheEntry[TARGET_INSTANCE];
Severity: Major
Found in lib/models/per-bundle-addon-cache/addon-proxy.js - About 30 mins to fix

There are no issues that match your filters.

Category
Status