kimjunh/giver-game

View on GitHub

Showing 8 of 1,127 total issues

Method path_to has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def path_to(page_name)
    case page_name

    when /^the home\s?page$/
      '/'
Severity: Minor
Found in features/support/paths.rb - About 1 hr to fix

    Method create has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        success = true
        gp = game_params
        begin 
          if gp[:expiration_time]
    Severity: Minor
    Found in app/controllers/games_controller.rb - About 1 hr to fix

      Method create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def create
          success = true
          gp = game_params
          begin 
            if gp[:expiration_time]
      Severity: Minor
      Found in app/controllers/games_controller.rb - 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

      Method check_if_played_and_reroute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def check_if_played_and_reroute
          game = GivingGame.find(params[:id])
          
          if !game.tutorial
            if current_user.present? and current_user.played_games.include? game.id
      Severity: Minor
      Found in app/controllers/games_controller.rb - 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

      Method update has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def update
          game = GivingGame.find(params[:id])
          gp = game_params
          begin 
            if gp[:expiration_time]
      Severity: Minor
      Found in app/controllers/games_controller.rb - About 1 hr to fix

        Method check_if_played_and_reroute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def check_if_played_and_reroute
            game = GivingGame.find(params[:id])
            
            if !game.tutorial
              if current_user.present? and current_user.played_games.include? game.id
        Severity: Minor
        Found in app/controllers/games_controller.rb - About 1 hr to fix

          Method update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              game = GivingGame.find(params[:id])
              gp = game_params
              begin 
                if gp[:expiration_time]
          Severity: Minor
          Found in app/controllers/games_controller.rb - 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

          Method play_game has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def play_game
              chosen_game = GivingGame.find(params[:id])
          
              if current_user.nil? and !chosen_game.tutorial?
                flash[:warning] = "You must be logged in to play an actual giving game."
          Severity: Minor
          Found in app/controllers/games_controller.rb - 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