gerard2p/koaton-cli

View on GitHub

Showing 56 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

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

              function test (...args) {
                  let script = '<script src="http://localhost:62627/livereload.js?snipver=1"></script>\n</body>';
                  glob.sync('doc/**/*.html').forEach((file) => {
                      let index = fs.readFileSync(file, 'utf-8').replace('</body>', script);
                      fs.writeFileSync(file, index, 'utf-8');
              Severity: Major
              Found in scripts/reloadjsdoc.js and 1 other location - About 1 hr to fix
              scripts/reloadcoverage.js on lines 6..13

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

              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

              function test () {
                  let script = '<script src="http://localhost:62627/livereload.js?snipver=1"></script>\n</body>';
                  glob.sync('coverage/**/*.html').forEach((file) => {
                      let index = fs.readFileSync(file, 'utf-8').replace('</body>', script);
                      fs.writeFileSync(file, index, 'utf-8');
              Severity: Major
              Found in scripts/reloadcoverage.js and 1 other location - About 1 hr to fix
              scripts/reloadjsdoc.js on lines 6..13

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

              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 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 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 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 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
                        Severity
                        Category
                        Status
                        Source
                        Language