Showing 333 of 1,278 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 # rubocop:disable Metrics/ClassLength
test "save" do
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
- 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 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.
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
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.
#
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
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
- 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 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
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 }
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"
- 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 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
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])
- 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 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
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
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
- 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 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
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
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")
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
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