gerard2p/koaton-cli

View on GitHub

Showing 44 of 56 total issues

Function persistmodel has 34 lines of code (exceeds 25 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

    Function toCRUDTable has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        toCRUDTable () {
            let definition = [];
            let actions = [];
            Object.keys(this).forEach((key) => {
                let entity = {};
    Severity: Minor
    Found in src/support/ORMModel.js - About 1 hr to fix

      Function createWatcher has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          createWatcher (reload) {
              let watcher = new Watch(ProyPath('public', this.directory, '**/*'), {
                  // ignored: ,
                  persistent: true,
                  ignoreInitial: true,
      Severity: Minor
      Found in src/support/EmberBuilder.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 StartKoatonServer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function StartKoatonServer (resolve, reject, nginx = false) {
          let watcher = new Watch('./**', {
              awaitWriteFinish: {
                  stabilityThreshold: 500,
                  pollInterval: 50
      Severity: Minor
      Found in src/deamon.js - About 1 hr to fix

        Function buildHosts has a Cognitive Complexity of 10 (exceeds 5 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

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

            constructor (target, source, watch = false) {
                /**
                 * This variable is used to store the sorces files of the package.
                 * @private
                 * @type {String[]}
        Severity: Minor
        Found in src/support/BundleItem.js - About 1 hr to fix

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

          export default function writeSync (...args) {
              let [file, content, mode] = args;
              /* istanbul ignore next */
              if (content.indexOf('koaton:static') > -1) {
                  return file;
          Severity: Minor
          Found in src/utils/write.js - About 1 hr to fix

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

            function GET (hostname) {
                return new Promise(function (resolve, reject) {
                    let [protocol, host] = hostname.split('//');
                    let url = host.split('/');
                    host = url[0];
            Severity: Minor
            Found in src/functions/get.js - About 1 hr to fix

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

                  add (...args) {
                      let [target, transforms, alias] = args;
                      if (target.indexOf(':') === -1) {
                          alias = target;
                          this.privot[target] = new MutableString(target, transforms);
              Severity: Minor
              Found in src/support/ExtendedStrings.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if ((!appName && !options.list) || (!appName && !!(options.use || options.prod || options.build || options.port))) {
                            console.log('   The command cannot be run this way.\n\tkoaton ember -h\n   to see help.'.yellow);
                            return res;
                        } else if (appName && !utils.canAccess(ProyPath('ember', appName)) && !!(options.use || options.prod || options.build || options.port)) {
                            console.log('  That ember app does not exist.');
                Severity: Major
                Found in src/commands/ember.js - About 1 hr to fix

                  Function remove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      remove (...args) {
                          let mutableItem = (args[0] instanceof this.Mutable ? args[0] : this[args[0]]);
                          if (!mutableItem) {
                              return this;
                          }
                  Severity: Minor
                  Found in src/support/MutableArray.js - About 55 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

                  Avoid deeply nested control flow statements.
                  Open

                              if (development && !onlypaths) {
                                  utils.write(ProyPath('public', 'css', index + target), concatCSS.content, 'utf-8', true);
                                  ITEM.add(`/css/${index + target}`);
                              } else if (!development) {
                                  concat.add(basename, concatCSS.content);
                  Severity: Major
                  Found in src/functions/builder.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if (!onlypaths) {
                                        utils.write(path.join('public', 'css', index + target), content.css.toString(), 'utf-8', true);
                                    }
                    Severity: Major
                    Found in src/functions/builder.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if (watchinFiles[index + target].length === 0) {
                                      error.push(`${__nok.red}   Pattern ${file} ${'not found'.red}`);
                                  }
                      Severity: Major
                      Found in src/functions/builder.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if (bundle.flatten) {
                                                fs.ensureDirSync(ProyPath('public', bundle.dest));
                                            } else {
                                                let targetnodes = file.split('/');
                                                let filtered = originalnodes.filter(n => targetnodes.indexOf(n) > -1).join('/');
                        Severity: Major
                        Found in src/support/CopyStatic.js - About 45 mins to fix

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

                          const hasChanged = function (oldbranch, newbranch) {
                                  if (oldbranch === undefined || newbranch === undefined) {
                                      return true;
                                  }
                                  for (const file of newbranch) {
                          Severity: Minor
                          Found in src/support/DetectChangesInArray.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

                          Avoid deeply nested control flow statements.
                          Open

                                      if (!development || !onlypaths) {
                                          for (const url of watchinFiles[index + target]) {
                                              concatCSS.add(target, fs.readFileSync(url));
                                          }
                                      }
                          Severity: Major
                          Found in src/functions/builder.js - About 45 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                    } else if (appName && !utils.canAccess(ProyPath('ember', appName)) && !!(options.use || options.prod || options.build || options.port)) {
                                        console.log('  That ember app does not exist.');
                                        return res;
                                    }
                            Severity: Major
                            Found in src/commands/ember.js - About 40 mins to fix

                              Function buildJS has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              export async function buildJS (target, bundle, development, onlypaths, logger) {
                              Severity: Minor
                              Found in src/functions/builder.js - About 35 mins to fix

                                Function buildCSS has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                export async function buildCSS (target, bundle, development, onlypaths, logger) {
                                Severity: Minor
                                Found in src/functions/builder.js - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language