gerard2p/koaton-cli

View on GitHub

Showing 44 of 56 total issues

Function buildCSS has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

export async function buildCSS (target, bundle, development, onlypaths, logger) {
    let error = [];
    process.stdout.write(`Building ${target} `);
    let start = process.hrtime();
    const ITEM = scfg.bundles[target] || new BundleItem(target, []);
Severity: Minor
Found in src/functions/builder.js - About 1 day 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 buildCSS has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function buildCSS (target, bundle, development, onlypaths, logger) {
    let error = [];
    process.stdout.write(`Building ${target} `);
    let start = process.hrtime();
    const ITEM = scfg.bundles[target] || new BundleItem(target, []);
Severity: Major
Found in src/functions/builder.js - About 4 hrs to fix

    Function copystatic has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    export default async function copystatic () {
        const config = requireNoCache(ProyPath('config', 'static')).default.copy;
        let promises = [];
        for (const bundle of config) {
            let compiled = false;
    Severity: Minor
    Found in src/support/CopyStatic.js - About 3 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 DetectChanges has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    async function DetectChanges (changed) {
        const newconf = requireNoCache(ProyPath('config', 'bundles.js')).default;
        for (const bundle of Object.keys(newconf)) {
            let mustrebuild = false;
            if (allBundles[bundle]) {
    Severity: Minor
    Found in src/support/CheckBundles.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 constructor has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        constructor () {
            this.port = process.env.port;
            this.env = process.env.NODE_ENV;
            if (!fs.existsSync(ProyPath('.koaton'))) {
                fs.writeFileSync(ProyPath('.koaton'), JSON.stringify({
    Severity: Major
    Found in src/support/Server.js - About 2 hrs to fix

      Function buildJS has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function buildJS (target, bundle, development, onlypaths, logger) {
          let error = [];
          process.stdout.write(`Building ${target} `);
          let start = process.hrtime();
          const ITEM = scfg.bundles[target] || new BundleItem(target, []);
      Severity: Major
      Found in src/functions/builder.js - About 2 hrs to fix

        Function buildNginx has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export async function buildNginx () {
            let nginxpath = await getnginxpath();
            let conf = fs.readFileSync(nginxpath + 'nginx.conf', 'utf-8');
            if (conf.indexOf('include sites-enabled/*') === -1) {
                conf = conf.replace(/http ?\{/igm, 'http {\n\tinclude ./sites-enabled/*.conf;');
        Severity: Minor
        Found in src/functions/nginx.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 constructor has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            constructor (name, ...args) {
                let [fields, relations = {}] = args;
                if (fields === undefined) {
                    throw new Error('fields can\'t be undefined');
                }
        Severity: Major
        Found in src/support/ORMModel.js - About 2 hrs to fix

          Function Action has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              .Action(async function Action (options) {
                  process.env.port = options.port || configuration.server.port;
                  options.production = options.production ? 'production' : 'development';
                  process.env.NODE_ENV = options.production;
                  const embercfg = configuration.ember;
          Severity: Minor
          Found in src/commands/serve.js - About 1 hr to fix

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

            export async function buildJS (target, bundle, development, onlypaths, logger) {
                let error = [];
                process.stdout.write(`Building ${target} `);
                let start = process.hrtime();
                const ITEM = scfg.bundles[target] || new BundleItem(target, []);
            Severity: Minor
            Found in src/functions/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 buildNginx has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function buildNginx () {
                let nginxpath = await getnginxpath();
                let conf = fs.readFileSync(nginxpath + 'nginx.conf', 'utf-8');
                if (conf.indexOf('include sites-enabled/*') === -1) {
                    conf = conf.replace(/http ?\{/igm, 'http {\n\tinclude ./sites-enabled/*.conf;');
            Severity: Minor
            Found in src/functions/nginx.js - About 1 hr to fix

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

              export default async function persistmodel (model, modelname, options) {
                  let override = await challenge(ProyPath('models', `${modelname}.js`), `The model ${modelname.green} already exits,do you want to override it?`, options.force);
                  if (override) {
                      write(ProyPath('models', modelname + '.js'), model.toCaminte());
                      if (options.rest) {
              Severity: Minor
              Found in src/functions/persistmodel.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 buildBundles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              async function buildBundles () {
                  if (Object.keys(configuration.bundles).length === 0) {
                      console.log(`   ${__ok.green} No bundles defined`);
                  } else {
                      await utils.mkdir(ProyPath('public', 'js'), -1);
              Severity: Minor
              Found in src/commands/build.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 copystatic has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default async function copystatic () {
                  const config = requireNoCache(ProyPath('config', 'static')).default.copy;
                  let promises = [];
                  for (const bundle of config) {
                      let compiled = false;
              Severity: Minor
              Found in src/support/CopyStatic.js - About 1 hr to fix

                Function live has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async live (nginxbuilt, live) {
                        let storebuffer = '';
                        return new Promise(async resolve => {
                            let appst = { log: false, result: '', success: false, pid: null, process: null };
                            let port = await detect(4200);
                Severity: Minor
                Found in src/support/EmberBuilder.js - About 1 hr to fix

                  Function shell has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function shell (display, command, cwd = process.cwd()) {
                      return new Promise(function (resolve) {
                          let shelllog = '';
                          if (skipshell) {
                              console.log(`+ ${display}\t${__ok}`.green);
                  Severity: Minor
                  Found in src/utils/shell.js - About 1 hr to fix

                    Function DetectChanges has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function DetectChanges (changed) {
                        const newconf = requireNoCache(ProyPath('config', 'bundles.js')).default;
                        for (const bundle of Object.keys(newconf)) {
                            let mustrebuild = false;
                            if (allBundles[bundle]) {
                    Severity: Minor
                    Found in src/support/CheckBundles.js - About 1 hr to fix

                      Function buildHosts has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          buildHosts = function buildHosts () {
                              const os = require('os');
                      
                              let subdomains = configuration.server;
                              let hostname = subdomains.host;
                      Severity: Minor
                      Found in src/commands/serve.js - About 1 hr to fix

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

                            async postbuild () {
                                const emberinternalname = require(this.path('package.json')).name;
                                let text = await readFile(ProyPath('public', this.directory, 'index.html'), { encoding: 'utf-8' }),
                                    indextemplate = await readFile(TemplatePath('ember_apps', 'index.handlebars'), 'utf-8'),
                                    meta = new RegExp(`<meta ?name="${emberinternalname}.*" ?content=".*" ?/>`);
                        Severity: Minor
                        Found in src/support/EmberBuilder.js - About 1 hr to fix

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

                          function LoadServer (resolve, reject, nginx) {
                              let PIDPromises = [];
                              let KoatonServer = spawn('node', ['app.js'], { shell: false, env: {liveReloadHost: liveReloadHost(), NODE_ENV: process.env.NODE_ENV} });
                              KoatonServer.stdout.on('data', (buffer) => {
                                  process.stdout.write(buffer);
                          Severity: Minor
                          Found in src/deamon.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language