bensaufley/code-words-web

View on GitHub
src/components/Game/index.js

Summary

Maintainability
A
3 hrs
Test Coverage

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 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

      There are no issues that match your filters.

      Category
      Status