aureooms/rejuvenate

View on GitHub
src/main.js

Summary

Maintainability
C
1 day
Test Coverage

Function main has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function main(argv) {
    const {command, options, isDefault} = parse(argv.slice(2));

    const globals = {
        tasks: undefined,
Severity: Major
Found in src/main.js - About 5 hrs to fix

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

    export default function main(argv) {
        const {command, options, isDefault} = parse(argv.slice(2));
    
        const globals = {
            tasks: undefined,
    Severity: Minor
    Found in src/main.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 checkStatus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function checkStatus(status, options, globals) {
        globals.debug({status});
        const {tracking, current, behind} = status;
        if (!current) throw new Error('No current branch');
        if (!tracking) throw new Error('Not tracking any remote branch');
    Severity: Minor
    Found in src/main.js - About 1 hr to fix

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

      function checkStatus(status, options, globals) {
          globals.debug({status});
          const {tracking, current, behind} = status;
          if (!current) throw new Error('No current branch');
          if (!tracking) throw new Error('Not tracking any remote branch');
      Severity: Minor
      Found in src/main.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

      There are no issues that match your filters.

      Category
      Status