tsg-ut/mnemo

View on GitHub

Showing 70 of 724 total issues

Function ioGenerator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    ioGenerator: (random) => {
        const numbers = [0, 0, 0];
        const primes = [2];
        for (let i = 3; i < 256; i++) {
            let flag = null;
Severity: Minor
Found in stages/factorization.js - About 55 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 deeply nested control flow statements.
Open

                    if (this.state.selectStart !== null && this.state.selectEnd !== null) {
                        this.setState({
                            moveStatus: 'move',
                        });
                    }
Severity: Major
Found in lib/board-component.jsx - About 45 mins to fix

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

        constructor(config) {
            super();
    
            this.height = config.height;
            this.width = config.width;
    Severity: Minor
    Found in lib/board.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

    Avoid deeply nested control flow statements.
    Open

                    } else if (event.type === 'pan') {
                        if (this.state.moveStart !== null) {
                            this.setState({
                                moveEnd: {x: blockX, y: blockY},
                            });
    Severity: Major
    Found in lib/board-component.jsx - About 45 mins to fix

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

          componentDidUpdate(prevProps) {
              if (prevProps.isMovingMode && !this.props.isMovingMode) {
                  this.resetMoveState();
              }
      
      
      Severity: Minor
      Found in lib/board-component.jsx - 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

      Avoid deeply nested control flow statements.
      Open

                          if (this.isSelectedBlock(startBlockX, startBlockY)) {
                              this.setState({
                                  moveStart: {x: startBlockX, y: startBlockY},
                                  moveEnd: {x: startBlockX, y: startBlockY},
                              });
      Severity: Major
      Found in lib/board-component.jsx - About 45 mins to fix

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

            componentDidUpdate(prevProps) {
                if (!prevProps.isAnimating && this.props.isAnimating) {
                    this.handleStartAnimation();
                }
        
        
        Severity: Minor
        Found in lib/data-component.jsx - 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

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

        module.exports.log = (a, b) => {
            if (a <= 0 || a === 1 || b <= 0 || (a === Infinity && b === Infinity)) {
                return NaN;
            }
        
        
        Severity: Minor
        Found in lib/util.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 {pass: false, message: 'positions of blocks are not unique'};
        Severity: Major
        Found in lib/validator.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return `translate(${BLOCK_SIZE / 2}, ${BLOCK_SIZE / 2})`;
          Severity: Major
          Found in lib/data-component.jsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return {pass: false, message: 'used blocks are not matching to the stage'};
            Severity: Major
            Found in lib/validator.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return {pass: false, message: 'used blocks are not matching to the stage'};
              Severity: Major
              Found in lib/validator.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return {y: `-=${BLOCK_SIZE / 2}`};
                Severity: Major
                Found in lib/data-component.jsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return {x: `-=${BLOCK_SIZE / 2}`};
                  Severity: Major
                  Found in lib/data-component.jsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return;
                    Severity: Major
                    Found in api/routes/stages.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return `y position of block ${index} exceeds the board size`;
                      Severity: Major
                      Found in lib/validator.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return {y: `+=${BLOCK_SIZE / 2}`};
                        Severity: Major
                        Found in lib/data-component.jsx - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return {pass: false, message: error};
                          Severity: Major
                          Found in lib/validator.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return `type of block ${index} is unknown`;
                            Severity: Major
                            Found in lib/validator.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return {x: `+=${BLOCK_SIZE / 2}`};
                              Severity: Major
                              Found in lib/data-component.jsx - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language