ember-cli/ember-cli

View on GitHub
lib/models/host-info-cache.js

Summary

Maintainability
C
7 hrs
Test Coverage
A
90%

Function getHostAddonInfo has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getHostAddonInfo(packageInfoForLazyEngine) {
    const cacheKey = `${this.project._packageInfo.realPath}-${packageInfoForLazyEngine.realPath}`;

    let hostInfoCacheEntry = this._hostAddonInfoCache.get(cacheKey);

Severity: Major
Found in lib/models/host-info-cache.js - About 2 hrs to fix

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

  findLCAHost(engineInstance) {
    // only compute once for a given engine
    // we're using the engine name as the cache key here because regardless of its
    // version, lazy engines will always get output to: `engines-dist/${engineName}`
    let lcaHost = this._lcaHostCache.get(engineInstance.name);
Severity: Minor
Found in lib/models/host-info-cache.js - About 1 hr to fix

Function _getBundledPackageInfos has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _getBundledPackageInfos(pkgInfoToStartAt) {
    let pkgInfos = this._bundledPackageInfoCache.get(pkgInfoToStartAt);

    if (pkgInfos) {
      return pkgInfos;
Severity: Minor
Found in lib/models/host-info-cache.js - About 1 hr to fix

Function getHostAddonInfo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  getHostAddonInfo(packageInfoForLazyEngine) {
    const cacheKey = `${this.project._packageInfo.realPath}-${packageInfoForLazyEngine.realPath}`;

    let hostInfoCacheEntry = this._hostAddonInfoCache.get(cacheKey);

Severity: Minor
Found in lib/models/host-info-cache.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 _getBundledPackageInfos has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  _getBundledPackageInfos(pkgInfoToStartAt) {
    let pkgInfos = this._bundledPackageInfoCache.get(pkgInfoToStartAt);

    if (pkgInfos) {
      return pkgInfos;
Severity: Minor
Found in lib/models/host-info-cache.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 findLCAHost has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  findLCAHost(engineInstance) {
    // only compute once for a given engine
    // we're using the engine name as the cache key here because regardless of its
    // version, lazy engines will always get output to: `engines-dist/${engineName}`
    let lcaHost = this._lcaHostCache.get(engineInstance.name);
Severity: Minor
Found in lib/models/host-info-cache.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

There are no issues that match your filters.

Category
Status