cattr-app/frontend-application

View on GitHub
app/compiler/index.js

Summary

Maintainability
A
2 hrs
Test Coverage

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

module.exports = (api, options) => {
    api.registerCommand('modules:compile', () => {
        console.log('Reading modules config file...');
        const p = api.resolve('app/etc/modules.config.json');
        if (!fs.existsSync(api.resolve('app/generated'))) {
Severity: Minor
Found in app/compiler/index.js - About 1 hr to fix

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

    module.exports = (api, options) => {
        api.registerCommand('modules:compile', () => {
            console.log('Reading modules config file...');
            const p = api.resolve('app/etc/modules.config.json');
            if (!fs.existsSync(api.resolve('app/generated'))) {
    Severity: Minor
    Found in app/compiler/index.js - About 45 mins 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

    Replace ········if·(fs.existsSync(api.resolve('app/etc/modules.local.json' with ····if·(fs.existsSync(api.resolve("app/etc/modules.local.json"
    Open

            if (fs.existsSync(api.resolve('app/etc/modules.local.json'))) {
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ···· with ······);⏎
    Open

            }
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ····
    Open

            }
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ····if·(fs.existsSync(api.resolve(app/etc/modules.${process.env.NODE_ENV}.json)))·{ with if·(⏎······fs.existsSync(api.resolve(app/etc/modules.${process.env.NODE_ENV}.json))
    Open

            if (fs.existsSync(api.resolve(`app/etc/modules.${process.env.NODE_ENV}.json`))) {
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········ with ····
    Open

            }
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ····················moduleConfig.type·===·'package' with ··········moduleConfig.type·===·"package"
    Open

                        moduleConfig.type === 'package' &&
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········fs.writeFileSync(api.resolve('app/generated/module.require.js'),·fdArray.join('\n')); with ····fs.writeFileSync(⏎······api.resolve("app/generated/module.require.js"),⏎······fdArray.join("\n")
    Open

            fs.writeFileSync(api.resolve('app/generated/module.require.js'), fdArray.join('\n'));
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ······
    Open

                return undefined;
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ············moduleList·=·merge(moduleList,·require(api.resolve('app/etc/modules.local.json'))); with ······moduleList·=·merge(⏎········moduleList,⏎········require(api.resolve("app/etc/modules.local.json"))
    Open

                moduleList = merge(moduleList, require(api.resolve('app/etc/modules.local.json')));
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ··api.registerCommand('modules:compile' with api.registerCommand("modules:compile"
    Open

        api.registerCommand('modules:compile', () => {
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········console.log('Reading·modules·config·file...' with ····console.log("Reading·modules·config·file..."
    Open

            console.log('Reading modules config file...');
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ····
    Open

            Object.keys(moduleList).forEach(moduleName => {
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ········
    Open

                    const moduleConfig = moduleList[moduleName];
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ····················(moduleConfig.hasOwnProperty('enabled' with ··········(moduleConfig.hasOwnProperty("enabled"
    Open

                        (moduleConfig.hasOwnProperty('enabled') ? moduleConfig.enabled : true)
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········ with ····
    Open

            });
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········fdArray.push('];' with ····fdArray.push("];"
    Open

            fdArray.push('];');
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········let·fdArray·=·['export·default·[' with ····let·fdArray·=·["export·default·["
    Open

            let fdArray = ['export default ['];
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ········
    Open

                    ) {
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ··
    Open

        });
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Definition for rule 'vue/attributes-order' was not found
    Open

    const fs = require('fs'),
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Insert );⏎··
    Open

            }
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········const·p·=·api.resolve('app/etc/modules.config.json' with ····const·p·=·api.resolve("app/etc/modules.config.json"
    Open

            const p = api.resolve('app/etc/modules.config.json');
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········if·(!fs.existsSync(api.resolve('app/generated' with ····if·(!fs.existsSync(api.resolve("app/generated"
    Open

            if (!fs.existsSync(api.resolve('app/generated'))) {
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········moduleList·=·merge(moduleList,·require(api.resolve(app/etc/modules.${process.env.NODE_ENV}.json))); with )·{⏎······moduleList·=·merge(⏎········moduleList,⏎········require(api.resolve(app/etc/modules.${process.env.NODE_ENV}.json))
    Open

                moduleList = merge(moduleList, require(api.resolve(`app/etc/modules.${process.env.NODE_ENV}.json`)));
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ····isObject·=·require('lodash/isObject' with ··isObject·=·require("lodash/isObject"
    Open

        isObject = require('lodash/isObject'),
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ····················console.log(${moduleName}·=>·added·package·as·static·require·dependency); with ··········console.log(⏎············${moduleName}·=>·added·package·as·static·require·dependency``
    Open

                        console.log(`${moduleName} => added package as static require dependency`);
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ····merge·=·require('lodash/merge' with ··merge·=·require("lodash/merge"
    Open

        merge = require('lodash/merge');
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ············fs.mkdirSync(api.resolve('app/generated' with ······fs.mkdirSync(api.resolve("app/generated"
    Open

                fs.mkdirSync(api.resolve('app/generated'));
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ····
    Open

            let moduleList = require(p);
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ······
    Open

                if (isObject(moduleList[moduleName])) {
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ········
    Open

                    if (
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ····console.log('Finished...' with );⏎····console.log("Finished..."
    Open

            console.log('Finished...');
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ············console.error('modules.config.json·was·not·found·in·[app/etc]·folder' with ······console.error("modules.config.json·was·not·found·in·[app/etc]·folder"
    Open

                console.error('modules.config.json was not found in [app/etc] folder');
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ········ with ····
    Open

            if (!fs.existsSync(api.resolve(p))) {
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Delete ··········
    Open

                        fdArray.push(`    () => require('${moduleConfig.ref}'),`);
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace 'fs' with "fs"
    Open

    const fs = require('fs'),
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
    Open

    /** @typedef {import('@vue/cli-service/lib/PluginAPI')} PluginAPI */
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    Replace ······}⏎······ with );⏎········}⏎
    Open

                    }
    Severity: Minor
    Found in app/compiler/index.js by eslint

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

    There are no issues that match your filters.

    Category
    Status