scottwillson/racing_on_rails

View on GitHub

Showing 333 of 1,278 total issues

Avoid too many return statements within this method.
Open

    return render(:new_login) if @person.errors.any?
Severity: Major
Found in app/controllers/people_controller.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return masters_categories.first if masters_categories.one?
    Severity: Major
    Found in app/models/categories/matching.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return ability_category if ability_category.include?(self)
      Severity: Major
      Found in app/models/categories/matching.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return candidate_categories.first if one_match?(candidate_categories)
        Severity: Major
        Found in app/models/categories/matching.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return highest_ability_category if highest_ability_category.include?(self)
          Severity: Major
          Found in app/models/categories/matching.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return render(:show)
            Severity: Major
            Found in app/controllers/competitions/bar_controller.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return candidate_categories.first if one_match?(candidate_categories)
              Severity: Major
              Found in app/models/categories/matching.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return highest_ability_category if highest_ability_category.include?(self)
                Severity: Major
                Found in app/models/categories/matching.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return highest_age_category if highest_age_category&.include?(self)
                  Severity: Major
                  Found in app/models/categories/matching.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return nil
                    Severity: Major
                    Found in app/models/categories/matching.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return highest_senior_category if highest_senior_category
                      Severity: Major
                      Found in app/models/categories/matching.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return nil if candidate_categories.empty?
                        Severity: Major
                        Found in app/models/categories/matching.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return render(:show)
                          Severity: Major
                          Found in app/controllers/competitions/bar_controller.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                  return candidate_categories.first if candidate_categories.one? && equipment?
                            Severity: Major
                            Found in app/models/categories/matching.rb - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return equipment_categories.first if equipment_categories.one?
                              Severity: Major
                              Found in app/models/categories/matching.rb - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                        return nil if candidate_categories.empty?
                                Severity: Major
                                Found in app/models/categories/matching.rb - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return redirect_to("http://#{RacingAssociation.current.static_host}/bar/#{@year}")
                                  Severity: Major
                                  Found in app/controllers/competitions/bar_controller.rb - About 30 mins to fix

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

                                          def points(result, rules)
                                            if rules[:use_source_result_points]
                                              result.points
                                    
                                            elsif result.upgrade
                                    Severity: Minor
                                    Found in app/models/competitions/calculations/points.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

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

                                      def location=(value)
                                        if value.present?
                                          self.city, self.state = value.split(",")
                                          self.city = city.strip if city
                                          self.state = state.strip if state
                                    Severity: Minor
                                    Found in app/models/event.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

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

                                        def self.same_time?(row)
                                          return false unless row.previous
                                          return true if row[:time].blank?
                                    
                                          if row[:time].present?
                                    Severity: Minor
                                    Found in app/models/results/results_file.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