scottwillson/racing_on_rails

View on GitHub

Showing 331 of 1,265 total issues

File person_test.rb has 1097 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "test_helper"

# :stopdoc:
class PersonTest < ActiveSupport::TestCase
  test "save" do
Severity: Major
Found in test/models/person_test.rb - About 2 days to fix

    Method best_match_in has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
    Open

        def best_match_in(event_categories, result_age = nil)
          debug "Category#best_match_in for #{name} in #{event_categories.map(&:name).join(', ')}"
    
          candidate_categories = event_categories.dup
    
    
    Severity: Minor
    Found in app/models/categories/matching.rb - About 1 day 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

    File results_file_test.rb has 602 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "test_helper"
    
    # :stopdoc:
    module Results
      # FIXME: DNF's not handled correctly.
    Severity: Major
    Found in test/models/results/results_file_test.rb - About 1 day to fix

      File multi_day_event_test.rb has 579 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require File.expand_path("../../test_helper", __dir__)
      
      # :stopdoc:
      class MultiDayEventTest < ActiveSupport::TestCase
        test "start end dates" do
      Severity: Major
      Found in test/models/events/multi_day_event_test.rb - About 1 day to fix

        File competition.rb has 496 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Competitions
          # Results that derive their results from other Events. Se TYPES.
          # Year-long: BAR, Ironman, WSBA Rider Rankings, Oregon Cup.
          # Event-based: Cross Crusade, Mount Tabor Series.
          #
        Severity: Minor
        Found in app/models/competitions/competition.rb - About 7 hrs to fix

          Class Competition has 55 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Competition < Event
              include Competitions::Categories
              include Competitions::Dates
              include Competitions::Naming
              include Competitions::Points
          Severity: Major
          Found in app/models/competitions/competition.rb - About 7 hrs to fix

            Method receive has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
            Open

              def receive(email)
                post = Post.new
            
                # Sometimes we get poorly-encoded data and New Relic chokes
                NewRelic::Agent.disable_all_tracing do
            Severity: Minor
            Found in app/models/mailing_list_mailer.rb - About 7 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

            File result_test.rb has 453 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require File.expand_path("../../test_helper", __dir__)
            
            # :stopdoc:
            class ResultTest < ActiveSupport::TestCase
              setup :number_issuer
            Severity: Minor
            Found in test/models/results/result_test.rb - About 6 hrs to fix

              File bar_test.rb has 452 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "test_helper"
              
              # :stopdoc:
              class Calculations::V3::BarTest < ActiveSupport::TestCase
                setup { FactoryBot.create :discipline }
              Severity: Minor
              Found in test/models/calculations/v3/bar_test.rb - About 6 hrs to fix

                Method normalize_spelling has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.normalize_spelling(name)
                        if name
                          name = name.split.map do |token|
                            if token[/\A(cat|caat|categpry|categroy|cateogry|categegory|catgory|caegory|ct)\.?\z/i]
                              "Category"
                Severity: Minor
                Found in app/models/categories/name_normalization.rb - About 6 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

                File results_controller_test.rb has 423 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require File.expand_path("../../test_helper", __dir__)
                
                module Admin
                  # :stopdoc:
                  class ResultsControllerTest < ActionController::TestCase
                Severity: Minor
                Found in test/controllers/admin/results_controller_test.rb - About 6 hrs to fix

                  Method create_login has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def create_login
                      @return_to = params[:return_to]
                  
                      if params[:id].present?
                        @person = Person.find_using_perishable_token(params[:id])
                  Severity: Minor
                  Found in app/controllers/people_controller.rb - About 5 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

                  Method best_match_in has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def best_match_in(event_categories, result_age = nil)
                        debug "Category#best_match_in for #{name} in #{event_categories.map(&:name).join(', ')}"
                  
                        candidate_categories = event_categories.dup
                  
                  
                  Severity: Major
                  Found in app/models/categories/matching.rb - About 5 hrs to fix

                    File place_test.rb has 380 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require_relative "../../../../app/models/competitions/calculations/calculator"
                    require_relative "calculations_test"
                    
                    # :stopdoc:
                    module Competitions
                    Severity: Minor
                    Found in test_ruby/models/competitions/calculations/place_test.rb - About 5 hrs to fix

                      Method merge has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def merge(other_person, force: false)
                            # Consider just using straight SQL for this --
                            # it's not complicated, and the current process generates an
                            # enormous amount of SQL
                      
                      
                      Severity: Minor
                      Found in app/models/people/merge.rb - About 4 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

                      Class Race has 37 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Race < ApplicationRecord
                        include Calculations::V3::Rejection
                        include Comparable
                        include Export::Races
                        include RacingOnRails::PaperTrail::Versions
                      Severity: Minor
                      Found in app/models/race.rb - About 4 hrs to fix

                        File teams_controller_test.rb has 368 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require File.expand_path("../../test_helper", __dir__)
                        
                        module Admin
                          # :stopdoc:
                          class TeamsControllerTest < ActionController::TestCase
                        Severity: Minor
                        Found in test/controllers/admin/teams_controller_test.rb - About 4 hrs to fix

                          Method get_expected_races has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def get_expected_races
                                races = []
                          
                                race = Race.new(category: Category.new(name: "Senior Men Pro/1/2/3"))
                                race.results << Result.new(place: "1", first_name: "Evan", last_name: "Elken", number: "154", license: "999999999", team_name: "Jittery Joe's", points: "23.0")
                          Severity: Major
                          Found in test/models/results/results_file_test.rb - About 4 hrs to fix

                            File login_test.rb has 362 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require File.expand_path("../../test_helper", __dir__)
                            
                            # :stopdoc:
                            class LoginTest < ActionController::TestCase
                              tests PeopleController
                            Severity: Minor
                            Found in test/controllers/people/login_test.rb - About 4 hrs to fix

                              File schedule_test.rb has 356 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              require File.expand_path("../../test_helper", __dir__)
                              
                              # :stopdoc:
                              class ScheduleTest < ActiveSupport::TestCase
                                test "create" do
                              Severity: Minor
                              Found in test/models/schedule/schedule_test.rb - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language