scottwillson/racing_on_rails

View on GitHub

Showing 331 of 1,265 total issues

Avoid too many return statements within this method.
Open

      return render(:new_login)
Severity: Major
Found in app/controllers/people_controller.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

      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 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 redirect_to("http://#{RacingAssociation.current.static_host}/bar/#{@year}/overall_by_age.html")
          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 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 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 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 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 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 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 candidate_categories.first if candidate_categories.size == 1
                        Severity: Major
                        Found in app/models/categories/matching.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                    return source_result.points if points_for_place.nil?
                          Severity: Major
                          Found in app/models/calculations/v3/steps/assign_points.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 diff if diff != 0
                              Severity: Major
                              Found in app/models/calculations/v3/steps/place.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 highest_ability_category if highest_ability_category.include?(self)
                                  Severity: Major
                                  Found in app/models/categories/matching.rb - About 30 mins to fix

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

                                        def add_name
                                          last_year = Time.zone.today.year - 1
                                          if name_was.present? && results_before_this_year? && names.none? { |name| name.year == last_year }
                                            name = names.build(name: name_was, year: last_year)
                                            name.first_name = first_name_was if respond_to?(:first_name)
                                    Severity: Minor
                                    Found in app/models/names/nameable.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 assign_member_from_imported_people has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def assign_member_from_imported_people(year)
                                        if @update_membership
                                          @member_from_imported_people = if year && year > Time.zone.today.year
                                                                           Time.zone.local(year).beginning_of_year.to_date
                                                                         else
                                    Severity: Minor
                                    Found in app/models/people_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