ember-cli/ember-cli

View on GitHub

Showing 150 of 221 total issues

EmberApp has 53 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 7 hrs to fix

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

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

    @public
Severity: Minor
Found in lib/models/addon.js - About 6 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 _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

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

async 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 _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 102 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

Project has 32 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

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

  async run(environmentPromiseHash) {
    if (environmentPromiseHash === undefined) {
      return Promise.reject(new Error('Unable to execute "run" command without environment argument'));
    }
    let shutdownOnExit = null;
Severity: Major
Found in lib/cli/cli.js - About 3 hrs to fix

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 _initVendorFiles has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _initVendorFiles() {
    let bowerDeps = this.project.bowerDependencies();
    let ember = this.project.findAddonByName('ember-source');
    let addonEmberCliShims = this.project.findAddonByName('ember-cli-shims');
    let bowerEmberCliShims = bowerDeps['ember-cli-shims'];
Severity: Major
Found in lib/broccoli/ember-app.js - About 2 hrs to fix

Function _initOptions has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  _initOptions(options) {
    let resolvePathFor = (defaultPath, specified) => {
      let path = defaultPath;
      if (specified && typeof specified === 'string') {
        path = specified;
Severity: Minor
Found in lib/broccoli/ember-app.js - About 2 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 instantiateAddons has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function instantiateAddons(parent, project, addonPackages) {
  // depending on whether this is really a project or an addon, the 'name' property may be a getter.
  let parentName = typeof parent.name === 'function' ? parent.name() : parent.name;

  logger.info('instantiateAddons for: ', parentName);
Severity: Major
Found in lib/models/instantiate-addons.js - About 2 hrs to fix

Function _import has 66 lines of code (exceeds 25 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: Major
Found in lib/broccoli/ember-app.js - About 2 hrs to fix

Function exports has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (initialMargin, shouldDescriptionBeGrey) {
  initialMargin = initialMargin || '';

  let output = '';

Severity: Major
Found in lib/utilities/print-command.js - About 2 hrs to fix

Function constructor has 64 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: Major
Found in lib/broccoli/ember-app.js - About 2 hrs to fix

Function exports has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = async function (options) {
  // `process` should be captured before we require any libraries which
  // may use `process.exit` work arounds for async cleanup.
  willInterruptProcess.capture(options.process || process);

Severity: Major
Found in lib/cli/index.js - About 2 hrs to fix

Function _fileMapTokens has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  _fileMapTokens(options) {
    let { project } = this;
    let standardTokens = {
      __name__(options) {
        if (options.pod && options.hasPathToken) {
Severity: Minor
Found in lib/models/blueprint.js - About 2 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 run has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async run(options) {
    let name = options.args[0];
    let noAddonBlueprint = ['mixin', 'blueprint-test'];

    let mainBlueprint = this.lookupBlueprint(name, options.ignoreMissingMain);
Severity: Major
Found in lib/tasks/generate-from-blueprint.js - About 2 hrs to fix

exports has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

module.exports = class DefaultPackager {
  constructor(options) {
    this._cachedTests = null;
    this._cachedBower = null;
    this._cachedVendor = null;
Severity: Minor
Found in lib/broccoli/default-packager.js - About 2 hrs to fix
Severity
Category
Status
Source
Language