Showing 333 of 1,278 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
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
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,
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.
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
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
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
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')
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]
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
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) },
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
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,
File place_test.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "../../v3"
module Calculations
module V3
module Steps
Method update_people
has a Cognitive Complexity of 18 (exceeds 5 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
- 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 place_results_by_time
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def place_results_by_time
_results = results.to_a.sort do |x, y|
if x.laps && y.laps && x.laps != y.laps
y.laps <=> x.laps
elsif x.time
- 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 tree_select
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def tree_select(categories, model, name, selected = 0, allow_root = true, level = 0, init = true)
html = +""
if init
html << "<select class=\"form-control\" name=\"#{model}[#{name}]\" id=\"#{model}_#{name}\">\n"
if allow_root
- 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 ages_from_name
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def ages_from_name(name)
if name[/\d{3}-\d{3}/]
age_range_match = /(\d{3})-(\d{3})/.match(name)
ages_begin = age_range_match[1].to_i / team_size(name)
ages_end = ((age_range_match[2].to_i + 1) / team_size(name)) - 1
- 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"