ember-cli/ember-cli

View on GitHub

Showing 291 of 291 total issues

File blueprint-test.js has 1299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const fs = require('fs-extra');
const Task = require('../../../lib/models/task');
const MockProject = require('../../helpers/mock-project');
Severity: Major
Found in tests/integration/models/blueprint-test.js - About 3 days to fix

File ember-app.js has 1146 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global require, module */
'use strict';

/**
@module ember-cli
Severity: Major
Found in lib/broccoli/ember-app.js - About 2 days to fix

File addon.js has 782 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/**
@module ember-cli
*/
Severity: Major
Found in lib/models/addon.js - About 1 day to fix

File blueprint.js has 684 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/**
@module ember-cli
*/
Severity: Major
Found in lib/models/blueprint.js - About 1 day to fix

File default-packager.js has 572 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const p = require('ember-cli-preprocess-registry/preprocessors');
const path = require('path');
const concat = require('broccoli-concat');
Severity: Major
Found in lib/broccoli/default-packager.js - About 1 day to fix

EmberApp has 56 functions (exceeds 20 allowed). Consider refactoring.
Open

class EmberApp {
  /**
   EmberApp is the main class Ember CLI uses to manage the Broccoli trees
   for your application. It is very tightly integrated with Broccoli and has
   a `toTree()` method you can use to get the entire tree for your application.
Severity: Major
Found in lib/broccoli/ember-app.js - About 1 day to fix

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

    it('calls appropriate hooks with correct arguments', async function() {
      options.entity = { name: 'foo' };

      await blueprint.install(options);
      expect(localsCalled).to.be.true;
Severity: Major
Found in tests/integration/models/blueprint-test.js and 1 other location - About 1 day to fix
tests/integration/models/blueprint-test.js on lines 700..713

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 195.

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

    it('calls appropriate hooks with correct arguments', async function() {
      options.entity = { name: 'foo' };

      await blueprint.uninstall(options);
      expect(localsCalled).to.be.true;
Severity: Major
Found in tests/integration/models/blueprint-test.js and 1 other location - About 1 day to fix
tests/integration/models/blueprint-test.js on lines 569..581

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 195.

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

  availableOptions: [
    { name: 'dry-run', type: Boolean, default: false, aliases: ['d'] },
    { name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
    { name: 'pod', type: Boolean, default: false, aliases: ['p', 'pods'] },
    { name: 'classic', type: Boolean, default: false, aliases: ['c'] },
Severity: Major
Found in lib/commands/generate.js and 1 other location - About 7 hrs to fix
lib/commands/destroy.js on lines 16..30

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 179.

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

  availableOptions: [
    { name: 'dry-run', type: Boolean, default: false, aliases: ['d'] },
    { name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
    { name: 'pod', type: Boolean, default: false, aliases: ['p', 'pods'] },
    { name: 'classic', type: Boolean, default: false, aliases: ['c'] },
Severity: Major
Found in lib/commands/destroy.js and 1 other location - About 7 hrs to fix
lib/commands/generate.js on lines 19..33

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 179.

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

addonProto has 51 functions (exceeds 20 allowed). Consider refactoring.
Open

let addonProto = {
  /**
    The name of this addon.

    @public
Severity: Major
Found in lib/models/addon.js - About 7 hrs to fix

Blueprint has 48 functions (exceeds 20 allowed). Consider refactoring.
Open

let Blueprint = CoreObject.extend({
  availableOptions: [],
  anonymousOptions: ['name'],

  _printableProperties: ['name', 'description', 'availableOptions', 'anonymousOptions', 'overridden'],
Severity: Minor
Found in lib/models/blueprint.js - About 6 hrs to fix

Function insertIntoFile has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

function insertIntoFile(fullPath, contentsToInsert, providedOptions) {
  let options = providedOptions || {};

  let returnValue = {
    path: fullPath,
Severity: Minor
Found in lib/utilities/insert-into-file.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 a Cognitive Complexity of 38 (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

File project.js has 406 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/**
@module ember-cli
*/
Severity: Minor
Found in lib/models/project.js - About 5 hrs to fix

File command.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const nopt = require('nopt');
const chalk = require('chalk');
const path = require('path');
Severity: Minor
Found in lib/models/command.js - About 5 hrs to fix

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

  _import(assetPath, options, directory, subdirectory, extension) {
    // TODO: refactor, this has gotten very messy. Relevant tests: tests/unit/broccoli/ember-app-test.js
    let basename = path.basename(assetPath);

    if (isType(assetPath, 'js', { registry: this.registry })) {
Severity: Minor
Found in lib/broccoli/ember-app.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 _initOptions has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _initOptions(options) {
    let resolvePathFor = (defaultPath, specified) => {
      let path = defaultPath;
      if (specified && typeof specified === 'string') {
        path = specified;
Severity: Major
Found in lib/broccoli/ember-app.js - About 4 hrs to fix

Function run has 107 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  run(environment) {
    let shutdownOnExit = null;

    return RSVP.hash(environment)
      .then(environment => {
Severity: Major
Found in lib/cli/cli.js - About 4 hrs to fix

Project has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

class Project {
  /**
    The Project model is tied to your package.json. It is instantiated
    by giving {{#crossLink "Project/closestSync:method"}}{{/crossLink}}
    the path to your project.
Severity: Minor
Found in lib/models/project.js - About 4 hrs to fix
Severity
Category
Status
Source
Language