DataEasy/slack-cutter

View on GitHub

Showing 8 of 22 total issues

Function parseArgs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    parseArgs(args) {
        if (!args || !args.length || args.length === 0) {
            return new Error('At least one argument is necessary');
        }
        if (args.length > 3 || args.length === 2) {
Severity: Minor
Found in lib/slash-commands/ci/ci.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 listPrs has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    listPrs(repository, callback) {
        if (arguments.length <= 1) {
            throw new Error('At least one argument must be passed');
        }

Severity: Minor
Found in lib/slash-commands/prs/prs.js - About 1 hr to fix

    Function formatLabels has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const formatLabels = prLabels => {
        const okMark = ':white_check_mark:';
        const notOkMark = ':x:';
        let out = '';
    
    
    Severity: Minor
    Found in lib/slash-commands/prs/custom-formatter.js - About 1 hr to fix

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

          parseArgs(args) {
              if (!args || !args.length || args.length === 0) {
                  return new Error('At least one argument is necessary');
              }
              if (args.length > 3 || args.length === 2) {
      Severity: Minor
      Found in lib/slash-commands/ci/ci.js - About 1 hr to fix

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

        const formatLabels = prLabels => {
            const okMark = ':white_check_mark:';
            const notOkMark = ':x:';
            let out = '';
        
        
        Severity: Minor
        Found in lib/slash-commands/prs/custom-formatter.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 find has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            find() {
                let searchString;
                let callback = arguments[0];
        
                if (arguments.length === 2) {
        Severity: Minor
        Found in lib/slash-commands/ext/ext.js - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

                          return new Error(`Unknown job for \`${ productName }\`: \`${ jobName }\``);
          Severity: Major
          Found in lib/slash-commands/ci/ci.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return undefined;
            Severity: Major
            Found in lib/slash-commands/ci/ci.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language