stopwords-iso/stopwords-collator

View on GitHub

Showing 6 of 6 total issues

Function start has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

exports.start = function (options) {

    internals.args = Bossy.parse(internals.definition, { argv: options.args });

    if (internals.args.i) {
Severity: Minor
Found in lib/index.js - About 5 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 start has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.start = function (options) {

    internals.args = Bossy.parse(internals.definition, { argv: options.args });

    if (internals.args.i) {
Severity: Major
Found in lib/index.js - About 3 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                        for (let k = 0; k < tabbed.length; ++k) {
                            const word = tabbed[k].trim().toLowerCase();
                            internals.stopwords.push(word);
                        }
    Severity: Major
    Found in lib/index.js - About 45 mins to fix

      Avoid too many return statements within this function.
      Open

                  return Log(`:: file error - ${ err.message }`);
      Severity: Major
      Found in lib/index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return Log(`:: saving txt error - ${ err.message }`);
        Severity: Major
        Found in lib/index.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return Log(`:: saving json error - ${ err.message }`);
          Severity: Major
          Found in lib/index.js - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language