ember-cli/ember-cli

View on GitHub

Showing 269 of 269 total issues

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

  _printHelp(commandOptions, rawArgs) {
    let rootCommand = new RootCommand({
      ui: this.ui,
      project: this.project,
      commands: this.commands,
Severity: Minor
Found in lib/commands/help.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 run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  async run(commandOptions) {
    let hasBuild = !!commandOptions.path;
    let outputPath;

    if (hasBuild) {
Severity: Minor
Found in lib/commands/test.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 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 constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(defaults, options) {
    if (arguments.length === 0) {
      options = {};
    } else if (arguments.length === 1) {
      options = defaults;
Severity: Minor
Found in lib/broccoli/ember-addon.js - About 1 hr to fix

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

  throwFormattedBroccoliError(err) {
    // TODO fix ember-cli/console-ui to handle current broccoli broccoliPayload
    let broccoliPayload = err && err.broccoliPayload;
    if (broccoliPayload) {
      if (!broccoliPayload.error) {
Severity: Minor
Found in lib/models/builder.js - About 1 hr to fix

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

  _fileSystemInfo() {
    if (this._cachedFileSystemInfo) {
      return this._cachedFileSystemInfo;
    }

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

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

  serverMiddleware(options) {
    let app = options.app;
    options = options.options;

    let broccoliMiddleware = options.middleware || require('broccoli-middleware').watcherMiddleware;
Severity: Minor
Found in lib/tasks/server/middleware/broccoli-watcher/index.js - About 1 hr to fix

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

  constructor(options) {
    this._cachedTests = null;
    this._cachedVendor = null;
    this._cachedPublic = null;
    this._cachedConfig = null;
Severity: Minor
Found in lib/broccoli/default-packager.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 stopAndReport has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  stopAndReport(name) {
    if (!instrumentationEnabled(this.config)) {
      return;
    }

Severity: Minor
Found in lib/models/instrumentation.js - About 1 hr to fix

Function isExperimentEnabled has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function isExperimentEnabled(experimentName) {
  if (!availableExperiments.includes(experimentName)) {
    return false;
  }

Severity: Minor
Found in lib/experiments/index.js - About 1 hr to fix

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

  constructor(options) {
    this.isVizEnabled = vizEnabled;
    this.isEnabled = instrumentationEnabled;

    this.ui = options.ui;
Severity: Minor
Found in lib/models/instrumentation.js - About 1 hr to fix

Function treeFor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  treeFor(treeType) {
    let node = heimdall.start({
      name: `treeFor(${this.name} - ${treeType})`,
      addonName: this.name,
      treeType,
Severity: Minor
Found in lib/models/addon.js - About 1 hr to fix

Function getPackageBlueprints has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getPackageBlueprints(collection, options, singleBlueprintName) {
    let verbose = options.verbose;
    let blueprints = collection.blueprints;

    if (!verbose) {
Severity: Minor
Found in lib/commands/generate.js - About 1 hr to fix

Function getAllBlueprints has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getAllBlueprints(options) {
    let lookupPaths = this.project.blueprintLookupPaths();
    let blueprintList = Blueprint.list({ paths: lookupPaths });

    let output = '';
Severity: Minor
Found in lib/commands/generate.js - About 1 hr to fix

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    if (commandOptions.in) {
      let relativePath = path.relative(this.project.root, commandOptions.in);
      commandOptions.in = path.resolve(relativePath);
    }
Severity: Major
Found in lib/commands/destroy.js and 1 other location - About 1 hr to fix
lib/commands/generate.js on lines 65..68

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    if (arguments.length === 0) {
      options = {};
    } else if (arguments.length === 1) {
      options = defaults;
    } else {
Severity: Major
Found in lib/broccoli/ember-app.js and 1 other location - About 1 hr to fix
lib/broccoli/ember-addon.js on lines 23..29

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    if (arguments.length === 0) {
      options = {};
    } else if (arguments.length === 1) {
      options = defaults;
    } else {
Severity: Major
Found in lib/broccoli/ember-addon.js and 1 other location - About 1 hr to fix
lib/broccoli/ember-app.js on lines 81..87

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (!fs.existsSync(this.startOptions.sslKey)) {
      throw new TypeError(
        `SSL key couldn't be found in "${this.startOptions.sslKey}", ` +
          `please provide a path to an existing ssl key file with --ssl-key`
      );
Severity: Major
Found in lib/tasks/server/express-server.js and 1 other location - About 1 hr to fix
lib/tasks/server/express-server.js on lines 72..77

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (!fs.existsSync(this.startOptions.sslCert)) {
      throw new TypeError(
        `SSL certificate couldn't be found in "${this.startOptions.sslCert}", ` +
          `please provide a path to an existing ssl certificate file with --ssl-cert`
      );
Severity: Major
Found in lib/tasks/server/express-server.js and 1 other location - About 1 hr to fix
lib/tasks/server/express-server.js on lines 65..70

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language