Showing 333 of 1,278 total issues
File calculator_test.rb
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "../../../../app/models/competitions/calculations/calculator"
require_relative "calculations_test"
# :stopdoc:
# TODO remove noisy member setup
Method categories_for
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def categories_for(race)
categories = super(race)
if year < 2016
categories << Category.find_or_create_by(name: "Masters Men A 40+") if race.name == "Masters 35+ A"
- Read upRead up
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 upcoming_test.rb
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
require File.expand_path("../../test_helper", __dir__)
# :stopdoc:
class UpcomingTest < ActiveSupport::TestCase
test "different dates" do
Method import
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def import(update_membership, year = nil)
ActiveSupport::Notifications.instrument(
"import.people_file.racing_on_rails", update_membership: update_membership, import_file: import_file, rows: table.rows.size
) do
@update_membership = update_membership
- Read upRead up
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 Result
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Result < ApplicationRecord
UNPLACED = 999_999
before_save :set_associated_records
Method normalize_spelling
has 92 lines of code (exceeds 25 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"
File set_associations_test.rb
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "test_helper"
# :stopdoc:
class SetAssociationsTest < ActiveSupport::TestCase
setup :number_issuer
File event_test.rb
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
require File.expand_path("../../test_helper", __dir__)
# :stopdoc:
class EventTest < ActiveSupport::TestCase
test "validate discipline" do
File best_match_in_test.rb
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "test_helper"
module Competitions
# :stopdoc:
class BestMatchInTest < ActiveSupport::TestCase
Method set_defaults
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def set_defaults
if new_record?
set_propogated_attributes
self.bar_points = default_bar_points if self[:bar_points].nil?
self.date = default_date if self[:date].nil?
- Read upRead up
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_many_ties
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_many_ties
men_9_18 = Models::Category.new("Men 9-18")
rules = Rules.new(category_rules: [Models::CategoryRule.new(men_9_18)], place_by: "place")
calculator = Calculator.new(rules: rules, source_results: [])
event_category = calculator.event_categories.first
File name_normalization.rb
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Categories
module NameNormalization
extend ActiveSupport::Concern
RACING_ASSOCIATIONS = %w[ ABA ATRA CBRA GBRA MBRA NABRA OBRA WSBA ].freeze
Method test_abilities_from_name
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_abilities_from_name
{
"12/24-Hour 2-Person" => 0..999,
"A Group" => 0..999,
"A Group Prime #1" => 0..999,
File people_controller_test.rb
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
require File.expand_path("../../test_helper", __dir__)
module Admin
# :stopdoc:
class PeopleControllerTest < ActionController::TestCase
Class Event
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Event < ApplicationRecord
TYPES = %w[ Event SingleDayEvent MultiDayEvent Series WeeklySeries ].freeze unless defined?(TYPES)
include Events::Children
include Events::Comparison
Method parse
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(row)
logger.debug(row.inspect) if logger.debug?
row[:instructional] = true if row[:discipline] == "Clinic"
- Read upRead up
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_bar
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_bar
category_pro_1_2 = Models::Category.new("Category Pro/1/2 Women")
category_3 = Models::Category.new("Category 3 Women")
category_rules = [
Models::CategoryRule.new(category_pro_1_2),
Method create_login
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_login
@return_to = params[:return_to]
if params[:id].present?
@person = Person.find_using_perishable_token(params[:id])
Method test_do_not_reject_unplaced
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_do_not_reject_unplaced
category_pro_1_2 = Models::Category.new("Category Pro/1/2 Women")
category_rules = [
Models::CategoryRule.new(category_pro_1_2)
]
File race.rb
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Race < ApplicationRecord
include Calculations::V3::Rejection
include Comparable
include Export::Races
include RacingOnRails::PaperTrail::Versions