ember-cli/ember-cli

View on GitHub

Showing 187 of 269 total issues

Blueprint has 50 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 7 hrs to fix

addonProto has 47 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

Function _readPackage has a Cognitive Complexity of 39 (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

EmberApp has 43 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: Minor
Found in lib/broccoli/ember-app.js - About 5 hrs to fix

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 (p.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 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

Project has 30 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 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 _initOptions has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _initOptions(options) {
    deprecate(
      'Using the `outputPaths` build option is deprecated, as output paths will no longer be predetermined under Embroider.',
      typeof options.outputPaths === 'undefined',
      {
Severity: Major
Found in lib/broccoli/ember-app.js - About 3 hrs to fix

Function constructor has 81 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 3 hrs to fix

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

  async run(commandOptions, rawArgs) {
    if (commandOptions.dryRun) {
      commandOptions.skipNpm = true;
    }

Severity: Major
Found in lib/commands/init.js - About 2 hrs to fix

Function run has 71 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 2 hrs to fix

Function createBlueprints has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    let entity = {
Severity: Major
Found in lib/tasks/generate-from-blueprint.js - About 2 hrs to fix

PackageInfo has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class PackageInfo {
  constructor(pkgObj, realPath, cache, isRoot = false) {
    this.pkg = pkgObj;
    this.pkg['ember-addon'] = this.pkg['ember-addon'] || {};
    this.realPath = realPath;
Severity: Minor
Found in lib/models/package-info-cache/package-info.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 (p.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 _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 contentFor has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function contentFor(config, match, type, options) {
  let content = [];

  // This normalizes `rootURL` to the value which we use everywhere inside of Ember CLI.
  // This makes sure that the user doesn't have to account for it in application code.
Severity: Major
Found in lib/utilities/ember-app-utils.js - About 2 hrs to fix

Function mergeTrees has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function mergeTrees(_inputTrees, options) {
  options = options || {};

  let node = heimdall.start(
    {
Severity: Major
Found in lib/broccoli/merge-trees.js - About 2 hrs to fix
Severity
Category
Status
Source
Language