ember-cli/ember-cli

View on GitHub

Showing 269 of 269 total issues

Function determineOutputs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

async function determineOutputs(version) {
  let tag = `v${version}`;
  let latestEC = await latestVersion('ember-cli');
  let isLatest = version === latestEC;
  let repo = `https://github-actions:${GITHUB_TOKEN}@github.com/${REPO}.git`;
Severity: Minor
Found in dev/update-editor-output-repos.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 jshintAddonTree has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  jshintAddonTree() {
    let trees = [];

    let addonPath = this._treePathFor('addon');
    if (fs.existsSync(addonPath)) {
Severity: Minor
Found in lib/models/addon.js - About 1 hr to fix

Function startHttpServer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async startHttpServer() {
    this.app = this.express();
    const compression = require('compression');
    this.app.use(
      compression({
Severity: Minor
Found in lib/tasks/server/express-server.js - About 1 hr to fix

Function _showObjErrors has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _showObjErrors(obj) {
    let errorEntries = obj.hasErrors() ? obj.errors.getErrors() : null;

    if (!errorEntries || (errorEntries.length === 1 && errorEntries[0].type === Errors.ERROR_PACKAGE_DIR_MISSING)) {
      return;
Severity: Minor
Found in lib/models/package-info-cache/index.js - About 1 hr to fix

Function _fileMapTokens has 45 lines of code (exceeds 25 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 1 hr to fix

Function getAddonInstance has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  getAddonInstance(parent, addonPkgInfo) {
    // If the new addon is itself a bundle host (i.e. lazy engine), there is only one
    // instance of the bundle host, and it's in the entries of the bundleHostCache, outside
    // of the 'regular' addon caches. Because 'setupBundleHostCache' ran during construction,
    // we know that an entry is in the cache with this engine name.
Severity: Minor
Found in lib/models/per-bundle-addon-cache/index.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

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

    if (this.options.addons.include) {
      this.options.addons.include.forEach((addonName) => {
        if (addonNames.indexOf(addonName) === -1) {
          throw new Error(`Addon "${addonName}" defined in "include" is not found`);
        }
Severity: Major
Found in lib/broccoli/ember-app.js and 1 other location - About 1 hr to fix
lib/broccoli/ember-app.js on lines 457..463

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

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 (this.hasYarnLock()) {
      logger.info('yarn.lock found -> trying yarn');
      try {
        const yarnResult = await this.checkYarn();
        logger.info('yarn found -> using yarn');
Severity: Major
Found in lib/tasks/npm-task.js and 1 other location - About 1 hr to fix
lib/tasks/npm-task.js on lines 171..182

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

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

Function exports has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (commands, commandName, commandArgs, optionHash) {
  let options = optionHash || {};
  let project = options.project;
  let ui = options.ui;

Severity: Minor
Found in lib/cli/lookup-command.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

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

    if (await this.hasPNPMLock()) {
      logger.info('pnpm-lock.yaml found -> trying pnpm');
      try {
        let result = await this.checkPNPM();
        logger.info('pnpm found -> using pnpm');
Severity: Major
Found in lib/tasks/npm-task.js and 1 other location - About 1 hr to fix
lib/tasks/npm-task.js on lines 158..169

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

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 (this.options.addons.exclude) {
      this.options.addons.exclude.forEach((addonName) => {
        if (addonNames.indexOf(addonName) === -1) {
          throw new Error(`Addon "${addonName}" defined in "exclude" is not found`);
        }
Severity: Major
Found in lib/broccoli/ember-app.js and 1 other location - About 1 hr to fix
lib/broccoli/ember-app.js on lines 465..471

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

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

Function _printHelp has 43 lines of code (exceeds 25 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

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

      } else {
        if (!allowImport('lastOneWins', this.vendorTestStaticStyles, assetPath, options)) {
          return;
        }
        if (options.prepend) {
Severity: Major
Found in lib/broccoli/ember-app.js and 1 other location - About 1 hr to fix
lib/broccoli/ember-app.js on lines 1187..1196

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

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

      } else if (options.type === 'test') {
        if (!allowImport('firstOneWins', this.legacyTestFilesToAppend, assetPath, options)) {
          return;
        }
        if (options.prepend) {
Severity: Major
Found in lib/broccoli/ember-app.js and 1 other location - About 1 hr to fix
lib/broccoli/ember-app.js on lines 1205..1214

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

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

Function packageStyles has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  packageStyles(tree) {
    if (this._cachedProcessedStyles === null) {
      let cssMinificationEnabled = this.minifyCSS.enabled;
      let options = {
        outputPaths: this.distPaths.appCssFile,
Severity: Minor
Found in lib/broccoli/default-packager.js - About 1 hr to fix

Function addAddonsToProject has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  addAddonsToProject(options) {
    let taskOptions = {
      packages: [],
      extraArgs: options.extraArgs || [],
      blueprintOptions: options.blueprintOptions || {},
Severity: Minor
Found in lib/models/blueprint.js - About 1 hr to fix

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

    if (fs.existsSync(addonTestSupportPath)) {
      let addonTestSupportTree = new Funnel(addonTestSupportPath, { destDir: 'addon-test-support' });
      let lintAddonTestSupportJsTrees = this._eachProjectAddonInvoke('lintTree', [
        'addon-test-support',
        addonTestSupportTree,
Severity: Major
Found in lib/models/addon.js and 2 other locations - About 1 hr to fix
lib/models/addon.js on lines 1197..1201
lib/models/addon.js on lines 1204..1208

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

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 3 locations. Consider refactoring.
Open

    if (fs.existsSync(appPath)) {
      let appTree = new Funnel(appPath, { destDir: 'app' });
      let lintAppJsTrees = this._eachProjectAddonInvoke('lintTree', ['app', appTree]);
      trees = trees.concat(lintAppJsTrees);
    }
Severity: Major
Found in lib/models/addon.js and 2 other locations - About 1 hr to fix
lib/models/addon.js on lines 1187..1194
lib/models/addon.js on lines 1204..1208

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

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 3 locations. Consider refactoring.
Open

    if (fs.existsSync(testSupportPath)) {
      let testSupportTree = new Funnel(testSupportPath, { destDir: 'test-support' });
      let lintTestSupportJsTrees = this._eachProjectAddonInvoke('lintTree', ['test-support', testSupportTree]);
      trees = trees.concat(lintTestSupportJsTrees);
    }
Severity: Major
Found in lib/models/addon.js and 2 other locations - About 1 hr to fix
lib/models/addon.js on lines 1187..1194
lib/models/addon.js on lines 1197..1201

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

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

Function validateAndRun has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  async validateAndRun(args) {
    let commandOptions = this.parseArgs(args);

    // If the `help` option was passed, resolve with `callHelp` to call the `help` command:
    if (commandOptions && (commandOptions.options.help || commandOptions.options.h)) {
Severity: Minor
Found in lib/models/command.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

Severity
Category
Status
Source
Language