SpencerCDixon/redux-cli

View on GitHub

Showing 7 of 17 total issues

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

const buildBlueprintCommand = (blueprint, runner) => {
  // extract custom command pieces
  let {
    aliases = [],
    options,
Severity: Major
Found in src/cli/cmds/generate/build-blueprint-command.js - About 2 hrs to fix

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

    const buildBlueprintCommand = (blueprint, runner) => {
      // extract custom command pieces
      let {
        aliases = [],
        options,
    Severity: Minor
    Found in src/cli/cmds/generate/build-blueprint-command.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 run has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      run(cliArgs) {
        this.confirmGit();
        this.createDirTask.run(cliArgs).then(() => {
          let fetch_url;
    
    
    Severity: Minor
    Found in src/sub-commands/new.js - About 1 hr to fix

      Function parseBlueprintSetting has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export function parseBlueprintSetting(setting) {
        if (_isArray(setting)) {
          return [...setting, './blueprints'];
        } else if (_isString(setting)) {
          return [setting, './blueprints'];
      Severity: Minor
      Found in src/models/blueprint-collection.js - About 35 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 too many return statements within this function.
      Open

          return ['./blueprints'];
      Severity: Major
      Found in src/models/blueprint-collection.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return depascalize(string, { separator: '-' });
        Severity: Major
        Found in src/util/text-helper.js - About 30 mins to fix

          Function normalizeCasing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export const normalizeCasing = (string, casing) => {
            const types = ['default', 'snake', 'pascal', 'camel', 'dashes'];
          
            if (types.indexOf(casing) === -1) {
              throw new Error(`Casing must be one of: ${types.join(', ')} types`);
          Severity: Minor
          Found in src/util/text-helper.js - About 25 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

          Severity
          Category
          Status
          Source
          Language