kanyuga/killer-counter

View on GitHub

Showing 30 of 30 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it ('foul port when none has been ported', () => {
const result = play(state, Actions.foulPort(5));
expect(result.players[2].current).toBe(true);
expect(result.balls[3].current).toBe(true);
expect(result.players[1].score).toBe(0);
Severity: Major
Found in src/__tests__/reducers.test.js and 1 other location - About 6 hrs to fix
src/__tests__/reducers.test.js on lines 56..63

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it ('port', () => {
const result = play(state, Actions.port(3));
expect(result.players[1].current).toBe(true);
expect(result.balls[3].active).toBe(false);
expect(result.players[1].score).toBe(6);
Severity: Major
Found in src/__tests__/reducers.test.js and 1 other location - About 6 hrs to fix
src/__tests__/reducers.test.js on lines 82..89

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    it ('current Player', () => {
    expect(Helpers.getCurrentPlayer(players)).toBe(0);
    players[0].current = false;
    players[1].current = true;
    expect(Helpers.getCurrentPlayer(players)).toBe(1);
    Severity: Major
    Found in src/__tests__/helpers.test.js and 1 other location - About 2 hrs to fix
    src/__tests__/helpers.test.js on lines 43..48

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    it ('current ball', () => {
    expect(Helpers.getCurrentBall(balls)).toEqual(1);
    balls[1].current = false;
    balls[3].current = true;
    expect(Helpers.getCurrentBall(balls)).toEqual(3);
    Severity: Major
    Found in src/__tests__/helpers.test.js and 1 other location - About 2 hrs to fix
    src/__tests__/helpers.test.js on lines 36..41

    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

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      players = [
      { name: "Player 1", score: 100, active: true, current: true },
      { name: "Player 2", score: 10, active: true, current: false },
      { name: "Player 3", score: 90, active: false, current: false },
      ];
      Severity: Major
      Found in src/__tests__/helpers.test.js and 1 other location - About 1 hr to fix
      src/__tests__/reducers.test.js on lines 8..12

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      state.players = [
      { name: 'Player 1', score: 0, active: true, current: false },
      { name: 'Player 2', score: 0, active: true, current: true },
      { name: 'Player 3', score: 0, active: true, current: false },
      ];
      Severity: Major
      Found in src/__tests__/reducers.test.js and 1 other location - About 1 hr to fix
      src/__tests__/helpers.test.js on lines 7..11

      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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        newState.playLog.push({ log: `${newState.players[currentPlayer].name} ported ${action.number}`, type: 'success' });
        Severity: Major
        Found in src/reducers.js and 1 other location - About 1 hr to fix
        src/reducers.js on lines 61..61

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        newState.playLog.push({ log: `${newState.players[currentPlayer].name} illegally ported ${action.number}`, type: 'fail' });
        Severity: Major
        Found in src/reducers.js and 1 other location - About 1 hr to fix
        src/reducers.js on lines 41..41

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        newState.playLog.push({ log: `${newState.players[currentPlayer].name} ported ${currentBall} followed by the white ball`, type: 'fail'});
        Severity: Major
        Found in src/reducers.js and 2 other locations - About 50 mins to fix
        src/reducers.js on lines 32..32
        src/reducers.js on lines 51..51

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        newState.playLog.push({ log: `${newState.players[currentPlayer].name} hit ${currentBall}`, type: ''});
        Severity: Major
        Found in src/reducers.js and 2 other locations - About 50 mins to fix
        src/reducers.js on lines 51..51
        src/reducers.js on lines 72..72

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        newState.playLog.push({ log: `${newState.players[currentPlayer].name} missed ${currentBall}`, type: 'fail' });
        Severity: Major
        Found in src/reducers.js and 2 other locations - About 50 mins to fix
        src/reducers.js on lines 32..32
        src/reducers.js on lines 72..72

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        <li className="nav-item">
        <a className="nav-link active" data-toggle="tab" href="#player-list" role="tab">Players</a>
        </li>
        Severity: Major
        Found in src/App.js and 2 other locations - About 45 mins to fix
        src/App.js on lines 98..100
        src/App.js on lines 101..103

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        <li className="nav-item">
        <a className="nav-link" data-toggle="tab" href="#leaderboard" role="tab">Leaderboard</a>
        </li>
        Severity: Major
        Found in src/App.js and 2 other locations - About 45 mins to fix
        src/App.js on lines 95..97
        src/App.js on lines 101..103

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <Button onClick={() => this.props.dispatch(hit())} size="lg" block context="info" title="Hit" />
        Severity: Minor
        Found in src/App.js and 1 other location - About 45 mins to fix
        src/App.js on lines 64..64

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <Button onClick={() => this.props.dispatch(miss())} size="lg" block context="danger" title="Miss" />
        Severity: Minor
        Found in src/App.js and 1 other location - About 45 mins to fix
        src/App.js on lines 63..63

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        <li className="nav-item">
        <a className="nav-link" data-toggle="tab" href="#play-log" role="tab">Log</a>
        </li>
        Severity: Major
        Found in src/App.js and 2 other locations - About 45 mins to fix
        src/App.js on lines 95..97
        src/App.js on lines 98..100
        Severity
        Category
        Status
        Source
        Language