yassinedoghri/marvel-jarvig

View on GitHub

Showing 21 of 44 total issues

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

  render() {
    const {
      game,
      passQuestion,
      checkAnswer,
Severity: Major
Found in src/containers/PlayScreen/QuestionCard.js - About 4 hrs to fix

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

      render() {
        const {
          isSettingsOpen,
          toggleSidebar,
          jarvigSettings,
    Severity: Major
    Found in src/containers/SidebarSettings.js - About 3 hrs to fix

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

        render() {
          const {
            game,
            passQuestion,
            checkAnswer,
      Severity: Minor
      Found in src/containers/PlayScreen/QuestionCard.js - About 3 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 render has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const { numberOfQuestions, gameResult, difficulty } = this.props;
      
          const resultCounts = getArrayCounts(gameResult);
      
      
      Severity: Major
      Found in src/containers/ResultScreen/index.js - About 2 hrs to fix

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

          render() {
            const { game, selectCharacter } = this.props;
        
            let gridItems = "";
            if (game.choices) {
        Severity: Major
        Found in src/containers/PlayScreen/CharactersGrid.js - About 2 hrs to fix

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

            render() {
              const {
                game,
                isGameLoading,
                passQuestion,
          Severity: Minor
          Found in src/containers/PlayScreen/index.js - About 1 hr to fix

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

              render() {
                const { location, time, game, isLoading, error } = this.props;
            
                const isGamePaused =
                  isLoading || // if game is loading
            Severity: Minor
            Found in src/containers/HeaderContent.js - About 1 hr to fix

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

                render() {
                  const { location, toggleSidebar } = this.props;
              
                  return (
                    <Footer>
              Severity: Minor
              Found in src/containers/FooterContent.js - About 1 hr to fix

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

                  componentDidUpdate() {
                    const {
                      callRequest,
                      game,
                      jarvigSettings,
                Severity: Minor
                Found in src/containers/PlayScreen/index.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

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

                export const generateAnswers = (
                  characters,
                  charactersPerQuestion,
                  bannedChars
                ) => {
                Severity: Minor
                Found in src/utils/helpers.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  render() {
                    const { numberOfQuestions, gameResult, difficulty } = this.props;
                
                    const resultCounts = getArrayCounts(gameResult);
                
                
                Severity: Minor
                Found in src/containers/ResultScreen/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

                Avoid too many return statements within this function.
                Open

                      return {
                        ...state,
                        game: {
                          ...state.game,
                          selected: action.payload
                Severity: Major
                Found in src/reducers/reducer-jarvig.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return {
                          ...state,
                          fetching: false,
                          error: null,
                          characters: action.payload,
                  Severity: Major
                  Found in src/reducers/reducer-jarvig.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return { ...state, fetching: false, error: action.payload };
                    Severity: Major
                    Found in src/reducers/reducer-jarvig.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return { ...state, fetching: true, error: null };
                      Severity: Major
                      Found in src/reducers/reducer-jarvig.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return {
                                ...state,
                                game: {
                                  ...state.game,
                                  result: [...state.game.result, action.payload ? "1" : "0"], // set 1 if correct, 0 if not
                        Severity: Major
                        Found in src/reducers/reducer-jarvig.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return {
                                  ...state,
                                  game: {
                                    ...state.game,
                                    time: action.payload
                          Severity: Major
                          Found in src/reducers/reducer-jarvig.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return {
                                    ...state,
                                    game: {
                                      ...state.game,
                                      over: true
                            Severity: Major
                            Found in src/reducers/reducer-jarvig.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return {
                                      ...state,
                                      game: {
                                        ...state.game,
                                        result: [...state.game.result, "0"], // set 0 as "wrong answer" because passed
                              Severity: Major
                              Found in src/reducers/reducer-jarvig.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return {
                                        ...state,
                                        game: {
                                          ...state.game,
                                          choices: null,
                                Severity: Major
                                Found in src/reducers/reducer-jarvig.js - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language