kanyuga/killer-counter

View on GitHub

Showing 5 of 30 total issues

Function render has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    let display;
    const playerForm = <PlayerForm />;
    if (this.props.started) {
      if (this.gameOver()) {
Severity: Major
Found in src/App.js - About 3 hrs to fix

    Function render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        let display;
        const playerForm = <PlayerForm />;
        if (this.props.started) {
          if (this.gameOver()) {
    Severity: Minor
    Found in src/App.js - About 2 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 play has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function play(state = initialState, action) {
      const newState = {...state};
      const currentPlayer = Helpers.getCurrentPlayer(newState.players);
      const currentBall = Helpers.getCurrentBall(newState.balls);
      let portedBall;
    Severity: Major
    Found in src/reducers.js - About 2 hrs to fix

      Function PlayerList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      let PlayerList = (props) => {
        let players = props.players.slice();
        const isLeaderboard = props.hasOwnProperty('sorted');
        if (isLeaderboard) {
          players = players.sort((player1, player2) => player2.score - player1.score);
      Severity: Minor
      Found in src/components/PlayerList.js - About 1 hr to fix

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

        export function defaultGameState(ballCount = 15) {
        
          const balls = {};
        
          for (let i = 1; i <= ballCount; i++) {
        Severity: Minor
        Found in src/helpers.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