ember-cli/ember-cli

View on GitHub

Showing 187 of 269 total issues

Function _addonTemplateFiles has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _addonTemplateFiles(addonTree) {
    if (this._cachedAddonTemplateFiles) {
      return this._cachedAddonTemplateFiles;
    }

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

Function compileAddon has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  compileAddon(tree) {
    if (!this.options) {
      throw new SilentError(
        `Ember CLI addons manage their own module transpilation during the \`treeForAddon\` processing. ` +
          `\`${this.name}\` (found at \`${this.root}\`) has removed \`this.options\` ` +
Severity: Minor
Found in lib/models/addon.js - About 1 hr to fix

Function memorySwapUsedLinux has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function memorySwapUsedLinux() {
  try {
    const { stdout } = execa.sync('free', ['-b']);
    const lines = stdout.split('\n').filter(Boolean);
    const header = lines.shift();
Severity: Minor
Found in lib/models/hardware-info.js - About 1 hr to fix

Function addDependencies has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  addDependencies(dependencies) {
    if (!dependencies) {
      return null;
    }

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

Function build has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  async build(addWatchDirCallback, resultAnnotation) {
    await this.ensureBroccoliBuilder();

    let buildResults, uiProgressIntervalID;

Severity: Minor
Found in lib/models/builder.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 getHostAddonInfo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  getHostAddonInfo(packageInfoForLazyEngine) {
    const cacheKey = `${this.project._packageInfo.realPath}-${packageInfoForLazyEngine.realPath}`;

    let hostInfoCacheEntry = this._hostAddonInfoCache.get(cacheKey);

Severity: Minor
Found in lib/models/host-info-cache.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 fileMapTokens has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  fileMapTokens() {
    return {
      __name__(options) {
        if (options.pod && options.hasPathToken) {
          return options.locals.blueprintName;
Severity: Minor
Found in blueprints/addon-import/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

Function processAppMiddlewares has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  processAppMiddlewares(options) {
    if (this.project.has(this.serverRoot)) {
      try {
        let server = this.project.require(this.serverRoot);

Severity: Minor
Found in lib/tasks/server/express-server.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 _getBundledPackageInfos has a Cognitive Complexity of 10 (exceeds 5 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

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

  addMiddleware(config) {
    let app = config.app;
    let options = config.options;
    let watcher = options.watcher;
    let rootURL = options.rootURL === '' ? '/' : cleanBaseURL(options.rootURL);
Severity: Minor
Found in lib/tasks/server/middleware/history-support/index.js - About 1 hr to fix

Function totalTime has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function totalTime(tree) {
  let totalTime = 0;
  let nodeItr;
  let node;
  let statName;
Severity: Minor
Found in lib/models/instrumentation.js - About 1 hr to fix

Function didChange has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  didChange(results) {
    let previousTree = this.tree;
    let files;

    if (results.stack) {
Severity: Minor
Found in lib/tasks/server/livereload-server.js - About 1 hr to fix

Function processAppAndDependencies has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  processAppAndDependencies(allTrees) {
    if (this._cachedProcessedAppAndDependencies === null) {
      let config = this.packageConfig();
      let internal = this.packageEmberCliInternalFiles();
      let appContentsWithCompiledTemplates = this._debugTree(
Severity: Minor
Found in lib/broccoli/default-packager.js - About 1 hr to fix

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

  run(options) {
    const chalk = require('chalk');
    let ui = this.ui;
    let packageNames = options.packages || [];
    let blueprintOptions = options.blueprintOptions || {};
Severity: Minor
Found in lib/tasks/addon-install.js - About 1 hr to fix

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

  serverMiddleware(options) {
    let app = options.app,
      server = options.options.httpServer;
    options = options.options;

Severity: Minor
Found in lib/tasks/server/middleware/proxy-server/index.js - About 1 hr to fix

Function processFilesForUninstall has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  processFilesForUninstall(intoDir, templateVariables) {
    let fileInfos = this._getFileInfos(this.files(this.options), intoDir, templateVariables);

    this._ignoreUpdateFiles();

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

Function addonCommands has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  addonCommands() {
    const Command = require('../models/command');
    let commands = Object.create(null);
    this.addons.forEach((addon) => {
      if (!addon.includedCommands) {
Severity: Minor
Found in lib/models/project.js - About 1 hr to fix

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

  async run(options) {
    let cwd = process.cwd();
    let name = options.rawName;
    let blueprintOption = options.blueprint;
    // If we're in a dry run, pretend we changed directories.
Severity: Minor
Found in lib/tasks/install-blueprint.js - About 1 hr to fix

Function configReplacePatterns has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function configReplacePatterns(options) {
  return [
    {
      match: /{{\s?rootURL\s?}}/g,
      replacement(config) {
Severity: Minor
Found in lib/utilities/ember-app-utils.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

    if (hasOptions) {
      let indent = `\n            `;
      let outdent = `\n          `;

      blueprintOptions =
Severity: Major
Found in blueprints/app/index.js - About 1 hr to fix
Severity
Category
Status
Source
Language