bensaufley/code-words-web

View on GitHub

Showing 17 of 17 total issues

File games.test.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import expect from '../test-setup';
import sinon from 'sinon';
import axios from 'axios';
import { MODAL_SHOW } from '../../src/ducks/modal';
import { DispatchStub } from '../support/dispatch-helper';
Severity: Minor
Found in test/ducks/games.test.js - About 3 hrs to fix

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

      static generateCompleteGame(game) {
        const turns = [],
              transmitters = game.players.filter((p) => p.role === 'transmitter').reduce((obj, p) => ({ ...obj, [p.team]: p }), {}),
              decoders = game.players.filter((p) => p.role === 'decoder').reduce((obj, p) => ({ ...obj, [p.team]: p }), {}),
              types = tileTypes(),
    Severity: Minor
    Found in test/dummies/turn.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 openWebSocket has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function openWebSocket(token) {
      return (dispatch) => {
        const webSocketUrl = `ws://${process.env.REACT_APP_API_URL}/api/v1/?access_token=${token}`;
        let initializeWebSocket,
            webSocket = new WebSocket(webSocketUrl);
    Severity: Minor
    Found in src/ducks/session.js - About 1 hr to fix

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

        render() {
          const {
                  canDrop,
                  connectDropTarget,
                  editable,
      Severity: Minor
      Found in src/components/Game/PlayerSlot.js - About 1 hr to fix

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

        export const SignUp = (props) => {
          const { handleSubmit, invalid, submitting } = props;
        
          return (
            <Form onSubmit={handleSubmit}>
        Severity: Minor
        Found in src/components/SignUp.js - About 1 hr to fix

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

            render() {
              const { id, loading } = this.props;
          
              if (loading) return (<Segment><Loader active /><Menu><Menu.Item><Icon name="bars" />Menu</Menu.Item><Menu.Item header>Loading Game…</Menu.Item></Menu></Segment>);
              if (!id) return (<Redirect to="/" />);
          Severity: Minor
          Found in src/components/Game/index.js - About 1 hr to fix

            Function renderCompletedModal has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              renderCompletedModal() {
                const {
                  id: gameId,
                  completed,
                  turns,
            Severity: Minor
            Found in src/components/Game/index.js - About 1 hr to fix

              Function generateCompleteGame has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static generateCompleteGame(game) {
                  const turns = [],
                        transmitters = game.players.filter((p) => p.role === 'transmitter').reduce((obj, p) => ({ ...obj, [p.team]: p }), {}),
                        decoders = game.players.filter((p) => p.role === 'decoder').reduce((obj, p) => ({ ...obj, [p.team]: p }), {}),
                        types = tileTypes(),
              Severity: Minor
              Found in test/dummies/turn.js - About 1 hr to fix

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

                  render() {
                    const {
                            canDrop,
                            connectDropTarget,
                            editable,
                Severity: Minor
                Found in src/components/Game/PlayerSlot.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 render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    const { connectDragSource, editable, id, isActive, isUser, role, team, user: { username } } = this.props,
                          className = [
                            'player',
                            'fluid',
                Severity: Minor
                Found in src/components/Game/Player.js - About 1 hr to fix

                  Function renderContainerWith has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const renderContainerWith = (render) => (providerProps = {}, routerProps = {}, appendToBody = false) => {
                    const { initialState, ...pProps } = providerProps,
                          state = Object.assign({
                            session: {}
                          }, initialState || {});
                  Severity: Minor
                  Found in test/support/container-helper.js - About 1 hr to fix

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

                      render() {
                        let links;
                    
                        if (this.props.session.apiToken) {
                          links = [(
                    Severity: Minor
                    Found in src/components/AppHeader.js - About 1 hr to fix

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

                        render() {
                          const { connectDragSource, editable, id, isActive, isUser, role, team, user: { username } } = this.props,
                                className = [
                                  'player',
                                  'fluid',
                      Severity: Minor
                      Found in src/components/Game/Player.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

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

                      function mapStateToProps({ games, session: { apiToken, apiUser } }) {
                        const sortedGames = games ? Object.keys(games).map((k) => games[k]).sort((a, b) => {
                          if (a.updatedAt < b.updatedAt) return 1;
                          if (a.updatedAt > b.updatedAt) return -1;
                          return 0;
                      Severity: Minor
                      Found in src/components/Games/index.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

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

                      const mapStateToProps = ({ session, games }, { match: { params: { id } } }) => {
                        if (!games) return { session, loading: true };
                        const game = games[id],
                              rematch = game &&
                                game.completed &&
                      Severity: Minor
                      Found in src/components/Game/index.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

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

                        renderCompletedModal() {
                          const {
                            id: gameId,
                            completed,
                            turns,
                      Severity: Minor
                      Found in src/components/Game/index.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

                      TODO found
                      Open

                          // TODO: spec Game component
                      Severity: Minor
                      Found in test/components/Game/index.test.js by fixme
                      Severity
                      Category
                      Status
                      Source
                      Language