scottwillson/racing_on_rails

View on GitHub

Showing 333 of 1,278 total issues

Method expected_results has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def expected_results(_event)
      expected_races = []

      race = Race.new(category: Category.new(name: "Category 3"))

Severity: Minor
Found in test/models/results/results_file_test.rb - About 1 hr to fix

    Method team_standings_category_for has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def team_standings_category_for(result)
            ages_begin = result["category_ages_begin"]
            ages_begin = ::Categories::Ages::SENIOR.begin if ages_begin == 0
    
            ages_end = result["category_ages_end"]
    Severity: Minor
    Found in app/models/competitions/grand_prix_brad_ross/team_standings.rb - About 1 hr to fix

      Method event has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def event
          if params[:key]
            year = params[:year] || RacingAssociation.current.effective_year
            calculation = Calculations::V3::Calculation.find_by(key: params[:key], year: year)
      
      
      Severity: Minor
      Found in app/controllers/results_controller.rb - About 1 hr to fix

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

            def update_people
              expir_date = Date.new(Time.zone.today.year, 12, 31)
              people_updated = []
              @members_list.each do |memusac|
                # get the parameters in a nice format
        Severity: Minor
        Found in app/models/results/usac_file.rb - About 1 hr to fix

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

                def self.render(column, row)
                  time = row[key(column)]
                  return nil if time.nil?
                  return time if time.is_a?(String) || time.is_a?(DateTime)
          
          
          Severity: Minor
          Found in app/helpers/results/renderers/time_renderer.rb - About 1 hr to fix

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

              def to_pdf(people, index = 0)
                Array.wrap(people).each do |person|
                  start_new_page if index.positive? && (index % 15).zero?
            
                  card_top = bounds.top_left.last - ((index % 15) / 3) * 144
            Severity: Minor
            Found in app/pdfs/card.rb - About 1 hr to fix

              Method equivalent_category_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def equivalent_category_for(category_friendly_param, discipline)
                      return nil unless category_friendly_param && discipline
              
                      if discipline == Discipline[:overall]
                        event = self
              Severity: Minor
              Found in app/models/competitions/overall_bars/categories.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 effective_year has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def effective_year
                  if next_year_start_at && Time.zone.now < 1.year.from_now(next_year_start_at)
                    if Time.zone.now < next_year_start_at
                      return Time.zone.now.year
                    elsif Time.zone.now >= next_year_start_at
              Severity: Minor
              Found in app/models/racing_association.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 set_place has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def set_place(result, row)
                    if result.numeric_place?
                      result.place = result.numeric_place
                      if race?(row) && result.place != 1
                        import_warnings << "First racer #{row[:first_name]} #{row[:last_name]} should be first place racer. "
              Severity: Minor
              Found in app/models/results/results_file.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 create_for_every! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.create_for_every!(days_of_week, params)
                  raise(ArgumentError) unless days_of_week && (params[:date] || params[:start_date]) && params[:end_date]
              
                  days_of_week = Array.wrap(days_of_week)
                  days_of_week.each do |day|
              Severity: Minor
              Found in app/models/multi_day_event.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 date_range_s has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def date_range_s(format = :short)
                    if format == :long
                      if start_date == end_date
                        date.strftime("%-m/%-d/%Y")
                      else
              Severity: Minor
              Found in app/models/competitions/dates.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 person has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def person
                  @person = Person.where(id: params[:person_id]).first
              
                  respond_to do |format|
                    format.html do
              Severity: Minor
              Found in app/controllers/results_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 team has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def team
                  @team = Team.where(id: params[:team_id]).first
                  respond_to do |format|
                    format.html do
                      if @team.nil?
              Severity: Minor
              Found in app/controllers/results_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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def update
                    @category = Category.find(params[:id])
                    @category.assign_attributes category_params
              
                    if @category.name_changed?
              Severity: Minor
              Found in app/controllers/admin/categories_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 calculate! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                      def self.calculate!(calculator)
                        return calculator.event_categories unless calculator.rules.place_by == "place"
              
                        calculator.event_categories.each do |category|
                          category.results
              Severity: Minor
              Found in app/models/calculations/v3/steps/reject_category_worst_results.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 calculate! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                      def self.calculate!(calculator)
                        calculator.event_categories.each do |category|
                          next if category.rejected?
              
                          place = 1
              Severity: Minor
              Found in app/models/calculations/v3/steps/place.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 test_calculate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def test_calculate
                        category = Models::Category.new("Women")
                        rules = Rules.new(
                          category_rules: [Models::CategoryRule.new(category)],
                          weekday_events: false

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

                    def categories_for(race)
                      ids = [race.category] + race.category.descendants
                
                      case race.category.name
                      when "Senior Men Pro/1/2"
                Severity: Minor
                Found in app/models/competitions/oregon_tt_cup.rb - About 1 hr to fix

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

                  function bindAutocompleteTeam() {
                    if (jQuery('.team_autocomplete').length) {
                      jQuery('.team_autocomplete').autocomplete({
                        delay: 200,
                        minLength: 3,
                  Severity: Minor
                  Found in app/assets/javascripts/application.js - About 1 hr to fix

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

                        def show
                          # Very explicit because we don't want to call something like 'eval' on a request parameter!
                          case params[:type]
                          when "rider_rankings"
                            competition_class = RiderRankings
                    Severity: Minor
                    Found in app/controllers/competitions/competitions_controller.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language