gerard2p/koaton-cli

View on GitHub
src/functions/builder.js

Summary

Maintainability
D
2 days
Test Coverage

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

      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 (!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

              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

                  There are no issues that match your filters.

                  Category
                  Status