scottwillson/racing_on_rails

View on GitHub

Showing 1,265 of 1,265 total issues

Class Person has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

class Person < ApplicationRecord
  LOGIN_FORMAT = /\A\w[\w.+\-_@ ]+\z/.freeze

  include Comparable
  include Export::People
Severity: Minor
Found in app/models/person.rb - About 3 hrs to fix

    File schedule_controller_test.rb has 286 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "test_helper"
    
    # :stopdoc:
    class ScheduleControllerTest < ActionController::TestCase #:nodoc: all
      test "index" do
    Severity: Minor
    Found in test/controllers/schedule_controller_test.rb - About 2 hrs to fix

      Method event_params has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def event_params
            _params = params.require(:event).permit(
              :additional_race_price,
              :all_events_discount,
              :atra_points_series,
      Severity: Major
      Found in app/controllers/admin/events_controller.rb - About 2 hrs to fix

        File person.rb has 283 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "sentient_user/sentient_user"
        
        # Someone who either appears in race results or who is added as a member of a racing association
        #
        # Names are _not_ unique. In fact, there are many business rules about names. See Aliases and Names.
        Severity: Minor
        Found in app/models/person.rb - About 2 hrs to fix

          File name_test.rb has 283 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "test_helper"
          
          module Categories
            # :stopdoc:
            class NameTest < ActiveSupport::TestCase
          Severity: Minor
          Found in test/models/categories/name_test.rb - About 2 hrs to fix

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

            require "test_helper"
            
            # :stopdoc:
            class ResultsControllerTest < ActionController::TestCase
              def setup
            Severity: Minor
            Found in test/controllers/results_controller_test.rb - About 2 hrs to fix

              Method receive has 69 lines of code (exceeds 25 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: Major
              Found in app/models/mailing_list_mailer.rb - About 2 hrs to fix

                Method test_group_by_age has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def test_group_by_age
                        source_results = []
                        athena = Models::Category.new("Athena")
                        clydesdale = Models::Category.new("Clydesdale")
                        men_5 = Models::Category.new("Men 5")

                  File map_source_results_to_results_test.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require_relative "../v3"
                  
                  module Calculations
                    module V3
                      # :stopdoc:

                    Function exports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function(api) {
                      var validEnv = ['development', 'test', 'production']
                      var currentEnv = api.env()
                      var isDevelopmentEnv = api.env('development')
                      var isProductionEnv = api.env('production')
                    Severity: Major
                    Found in babel.config.js - About 2 hrs to fix

                      File events_controller.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module Admin
                        # Show Schedule, add and edit Events, edit Results for Events. Promoters can view and edit their own events. Promoters can edit
                        # fewer fields than administrators.
                        class EventsController < Admin::AdminController
                          before_action :assign_event, only: %i[edit update]
                      Severity: Minor
                      Found in app/controllers/admin/events_controller.rb - About 2 hrs to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                              person.member_from = Time.zone.local(2001, 1, 1)
                              person.member_to = Time.zone.local(2001, 12, 31)
                              assert_equal(false, person.member?, "member?")
                              assert_equal(false, person.member?(Time.zone.local(2000, 12, 31)), "member")
                              assert_equal(true, person.member?(Time.zone.local(2001, 1, 1)), "member")
                        Severity: Major
                        Found in test/models/person_test.rb and 1 other location - About 2 hrs to fix
                        test/models/person_test.rb on lines 389..399

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 94.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                              person.member_from = Time.zone.local(2001, 1, 1)
                              person.member_to = Time.zone.local(2001, 12, 31)
                              assert_equal(false, person.member?, "member?")
                              assert_equal(false, person.member?(Time.zone.local(2000, 12, 31)), "member")
                              assert_equal(true, person.member?(Time.zone.local(2001, 1, 1)), "member")
                        Severity: Major
                        Found in test/models/person_test.rb and 1 other location - About 2 hrs to fix
                        test/models/person_test.rb on lines 403..413

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 94.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          test "index with alias" do
                            FactoryBot.create(:discipline)
                            FactoryBot.create(:mtb_discipline)
                            FactoryBot.create(:number_issuer)
                        
                        
                        Severity: Major
                        Found in test/controllers/schedule_controller_test.rb and 1 other location - About 2 hrs to fix
                        test/controllers/schedule_controller_test.rb on lines 122..150

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 93.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          test "mtb index" do
                            FactoryBot.create(:discipline)
                            FactoryBot.create(:mtb_discipline)
                            FactoryBot.create(:number_issuer)
                            year = 2006
                        Severity: Major
                        Found in test/controllers/schedule_controller_test.rb and 1 other location - About 2 hrs to fix
                        test/controllers/schedule_controller_test.rb on lines 209..238

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 93.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Class CalculatorTest has 23 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            class CalculatorTest < CalculationsTest
                              def test_calculate_with_no_source_results
                                assert_equal [], Calculator.calculate([])
                              end
                        
                        
                        Severity: Minor
                        Found in test_ruby/models/competitions/calculations/calculator_test.rb - About 2 hrs to fix

                          Method test_last_result_should_break_tie_different_dates has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def test_last_result_should_break_tie_different_dates
                                  source_results = [
                                    result(points: 355, participant_id: 1, scores: [
                                             { numeric_place: 1, points: 30, date: Date.new(2015, 9, 13) },
                                             { numeric_place: 1, points: 30, date: Date.new(2015, 9, 13) },
                          Severity: Major
                          Found in test_ruby/models/competitions/calculations/place_test.rb - About 2 hrs to fix

                            Method merge has 62 lines of code (exceeds 25 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: Major
                            Found in app/models/people/merge.rb - About 2 hrs to fix

                              Method person_params has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def person_params
                                    params.require(:person).permit(
                                      :administrator,
                                      :billing_city,
                                      :billing_country_code,
                              Severity: Major
                              Found in app/controllers/admin/people_controller.rb - About 2 hrs to fix

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

                                require_relative "../../v3"
                                
                                module Calculations
                                  module V3
                                    module Steps
                                Severity: Minor
                                Found in test_ruby/models/calculations/v3/steps/place_test.rb - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language