RuslanZavacky/ember-cli-ifa

View on GitHub
index.js

Summary

Maintainability
A
3 hrs
Test Coverage

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

  postBuild(build) {
    this._super.included.apply(this, arguments);

    const ifaConfig = this._config();

Severity: Minor
Found in 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 postBuild has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  postBuild(build) {
    this._super.included.apply(this, arguments);

    const ifaConfig = this._config();

Severity: Minor
Found in index.js - About 1 hr to fix

    'require' is not defined.
    Open

    const fs = require('fs');
    Severity: Minor
    Found in index.js by eslint

    Disallow Undeclared Variables (no-undef)

    This rule can help you locate potential ReferenceErrors resulting from misspellings of variable and parameter names, or accidental implicit globals (for example, from forgetting the var keyword in a for loop initializer).

    Rule Details

    Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global ...*/ comment.

    Examples of incorrect code for this rule:

    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    Examples of correct code for this rule with global declaration:

    /*global someFunction b:true*/
    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    The b:true syntax in /*global */ indicates that assignment to b is correct.

    Examples of incorrect code for this rule with global declaration:

    /*global b*/
    /*eslint no-undef: "error"*/
    
    b = 10;

    By default, variables declared in /*global */ are read-only, therefore assignment is incorrect.

    Options

    • typeof set to true will warn for variables used inside typeof check (Default false).

    typeof

    Examples of correct code for the default { "typeof": false } option:

    /*eslint no-undef: "error"*/
    
    if (typeof UndefinedIdentifier === "undefined") {
        // do something ...
    }

    You can use this option if you want to prevent typeof check on a variable which has not been declared.

    Examples of incorrect code for the { "typeof": true } option:

    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Examples of correct code for the { "typeof": true } option with global declaration:

    /*global a*/
    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Environments

    For convenience, ESLint provides shortcuts that pre-define global variables exposed by popular libraries and runtime environments. This rule supports these environments, as listed in Specifying Environments. A few examples are given below.

    browser

    Examples of correct code for this rule with browser environment:

    /*eslint no-undef: "error"*/
    /*eslint-env browser*/
    
    setTimeout(function() {
        alert("Hello");
    });

    node

    Examples of correct code for this rule with node environment:

    /*eslint no-undef: "error"*/
    /*eslint-env node*/
    
    var fs = require("fs");
    module.exports = function() {
        console.log(fs);
    };

    When Not To Use It

    If explicit declaration of global variables is not to your taste.

    Compatibility

    This rule provides compatibility with treatment of global variables in JSHint and JSLint. Source: http://eslint.org/docs/rules/

    'require' is not defined.
    Open

    const path = require('path');
    Severity: Minor
    Found in index.js by eslint

    Disallow Undeclared Variables (no-undef)

    This rule can help you locate potential ReferenceErrors resulting from misspellings of variable and parameter names, or accidental implicit globals (for example, from forgetting the var keyword in a for loop initializer).

    Rule Details

    Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global ...*/ comment.

    Examples of incorrect code for this rule:

    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    Examples of correct code for this rule with global declaration:

    /*global someFunction b:true*/
    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    The b:true syntax in /*global */ indicates that assignment to b is correct.

    Examples of incorrect code for this rule with global declaration:

    /*global b*/
    /*eslint no-undef: "error"*/
    
    b = 10;

    By default, variables declared in /*global */ are read-only, therefore assignment is incorrect.

    Options

    • typeof set to true will warn for variables used inside typeof check (Default false).

    typeof

    Examples of correct code for the default { "typeof": false } option:

    /*eslint no-undef: "error"*/
    
    if (typeof UndefinedIdentifier === "undefined") {
        // do something ...
    }

    You can use this option if you want to prevent typeof check on a variable which has not been declared.

    Examples of incorrect code for the { "typeof": true } option:

    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Examples of correct code for the { "typeof": true } option with global declaration:

    /*global a*/
    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Environments

    For convenience, ESLint provides shortcuts that pre-define global variables exposed by popular libraries and runtime environments. This rule supports these environments, as listed in Specifying Environments. A few examples are given below.

    browser

    Examples of correct code for this rule with browser environment:

    /*eslint no-undef: "error"*/
    /*eslint-env browser*/
    
    setTimeout(function() {
        alert("Hello");
    });

    node

    Examples of correct code for this rule with node environment:

    /*eslint no-undef: "error"*/
    /*eslint-env node*/
    
    var fs = require("fs");
    module.exports = function() {
        console.log(fs);
    };

    When Not To Use It

    If explicit declaration of global variables is not to your taste.

    Compatibility

    This rule provides compatibility with treatment of global variables in JSHint and JSLint. Source: http://eslint.org/docs/rules/

    'module' is not defined.
    Open

    module.exports = {
    Severity: Minor
    Found in index.js by eslint

    Disallow Undeclared Variables (no-undef)

    This rule can help you locate potential ReferenceErrors resulting from misspellings of variable and parameter names, or accidental implicit globals (for example, from forgetting the var keyword in a for loop initializer).

    Rule Details

    Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global ...*/ comment.

    Examples of incorrect code for this rule:

    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    Examples of correct code for this rule with global declaration:

    /*global someFunction b:true*/
    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    The b:true syntax in /*global */ indicates that assignment to b is correct.

    Examples of incorrect code for this rule with global declaration:

    /*global b*/
    /*eslint no-undef: "error"*/
    
    b = 10;

    By default, variables declared in /*global */ are read-only, therefore assignment is incorrect.

    Options

    • typeof set to true will warn for variables used inside typeof check (Default false).

    typeof

    Examples of correct code for the default { "typeof": false } option:

    /*eslint no-undef: "error"*/
    
    if (typeof UndefinedIdentifier === "undefined") {
        // do something ...
    }

    You can use this option if you want to prevent typeof check on a variable which has not been declared.

    Examples of incorrect code for the { "typeof": true } option:

    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Examples of correct code for the { "typeof": true } option with global declaration:

    /*global a*/
    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Environments

    For convenience, ESLint provides shortcuts that pre-define global variables exposed by popular libraries and runtime environments. This rule supports these environments, as listed in Specifying Environments. A few examples are given below.

    browser

    Examples of correct code for this rule with browser environment:

    /*eslint no-undef: "error"*/
    /*eslint-env browser*/
    
    setTimeout(function() {
        alert("Hello");
    });

    node

    Examples of correct code for this rule with node environment:

    /*eslint no-undef: "error"*/
    /*eslint-env node*/
    
    var fs = require("fs");
    module.exports = function() {
        console.log(fs);
    };

    When Not To Use It

    If explicit declaration of global variables is not to your taste.

    Compatibility

    This rule provides compatibility with treatment of global variables in JSHint and JSLint. Source: http://eslint.org/docs/rules/

    'process' is not defined.
    Open

        const env = process.env.EMBER_ENV;
    Severity: Minor
    Found in index.js by eslint

    Disallow Undeclared Variables (no-undef)

    This rule can help you locate potential ReferenceErrors resulting from misspellings of variable and parameter names, or accidental implicit globals (for example, from forgetting the var keyword in a for loop initializer).

    Rule Details

    Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global ...*/ comment.

    Examples of incorrect code for this rule:

    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    Examples of correct code for this rule with global declaration:

    /*global someFunction b:true*/
    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    The b:true syntax in /*global */ indicates that assignment to b is correct.

    Examples of incorrect code for this rule with global declaration:

    /*global b*/
    /*eslint no-undef: "error"*/
    
    b = 10;

    By default, variables declared in /*global */ are read-only, therefore assignment is incorrect.

    Options

    • typeof set to true will warn for variables used inside typeof check (Default false).

    typeof

    Examples of correct code for the default { "typeof": false } option:

    /*eslint no-undef: "error"*/
    
    if (typeof UndefinedIdentifier === "undefined") {
        // do something ...
    }

    You can use this option if you want to prevent typeof check on a variable which has not been declared.

    Examples of incorrect code for the { "typeof": true } option:

    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Examples of correct code for the { "typeof": true } option with global declaration:

    /*global a*/
    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Environments

    For convenience, ESLint provides shortcuts that pre-define global variables exposed by popular libraries and runtime environments. This rule supports these environments, as listed in Specifying Environments. A few examples are given below.

    browser

    Examples of correct code for this rule with browser environment:

    /*eslint no-undef: "error"*/
    /*eslint-env browser*/
    
    setTimeout(function() {
        alert("Hello");
    });

    node

    Examples of correct code for this rule with node environment:

    /*eslint no-undef: "error"*/
    /*eslint-env node*/
    
    var fs = require("fs");
    module.exports = function() {
        console.log(fs);
    };

    When Not To Use It

    If explicit declaration of global variables is not to your taste.

    Compatibility

    This rule provides compatibility with treatment of global variables in JSHint and JSLint. Source: http://eslint.org/docs/rules/

    Replace 'fs' with "fs"
    Open

    const fs = require('fs');
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ·?·encodeURIComponent(JSON.stringify(assetMap))·:·'' with ⏎····?·encodeURIComponent(JSON.stringify(assetMap))⏎····:·""
    Open

      const assetMapString = assetMap ? encodeURIComponent(JSON.stringify(assetMap)) : '';
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'head' with "head"
    Open

        if (type !== 'head') {
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace '/' with "/"
    Open

        let fingerprintPrepend = '/';
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace ·encoding:·'utf-8' with ⏎········encoding:·"utf-8"⏎·····
    Open

          let assetMapContent = fs.readFileSync(assetFileNamePath, { encoding: 'utf-8' });
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace '__ember-cli-ifa__AssetMapPlaceholder__' with "__ember-cli-ifa__AssetMapPlaceholder__"
    Open

    const MetaPlaceholder = '__ember-cli-ifa__AssetMapPlaceholder__';
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'When·running·fastboot,·ember-cli-ifa·is·forced·into·inline·mode.' with ⏎········"When·running·fastboot,·ember-cli-ifa·is·forced·into·inline·mode."⏎······
    Open

          this.ui.writeLine('When running fastboot, ember-cli-ifa is forced into inline mode.');
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'index.html' with "index.html"
    Open

        replacePlaceholder(path.join(build.directory, 'index.html'), assetMap);
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'use·strict' with "use·strict"
    Open

    'use strict';
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'utf-8' with "utf-8"
    Open

      const fileBody = fs.readFileSync(filePath, { encoding: 'utf-8' });
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Delete ,
    Open

      },
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'ember-cli-ifa' with "ember-cli-ifa"
    Open

      name: 'ember-cli-ifa',
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'ember-cli-ifa·currently·only·supports·being·a·top-level·dependency!·If·you·are·seeing·this·message·please·open·an·issue·on·https://github.com/RuslanZavacky/ember-cli-ifa/issues' with "ember-cli-ifa·currently·only·supports·being·a·top-level·dependency!·If·you·are·seeing·this·message·please·open·an·issue·on·https://github.com/RuslanZavacky/ember-cli-ifa/issues"
    Open

            'ember-cli-ifa currently only supports being a top-level dependency! If you are seeing this message please open an issue on https://github.com/RuslanZavacky/ember-cli-ifa/issues'
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'assets/assetMap.js' with "assets/assetMap.js"
    Open

        manifest.vendorFiles.push('assets/assetMap.js');
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'tests/index.html' with "tests/index.html"
    Open

        let testIndexPath = path.join(build.directory, 'tests/index.html');
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'path' with "path"
    Open

    const path = require('path');
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace 'assets' with "assets"
    Open

        const files = fs.readdirSync(path.join(build.directory, 'assets'));
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    Replace '.js' with ".js"
    Open

            const assetModulePath = assetFileNamePath.replace(/\.json$/, '.js');
    Severity: Minor
    Found in index.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status