Showing 333 of 1,278 total issues
Consider simplifying this complex logical expression. Open
elsif token[/\Amaster\z/i] || token[/\Amas\z/i] || token[/\Amstr?\z/i] || token[/\Amaster's\z/i] ||
token[/\Amast.?\z/i] || token[/\Amaasters\z/i] || token[/\Amastes\z/i] || token[/\Amastres\z/i] ||
token[/\Amater\z/i] || token[/\Amaser\z/i] || token[/\Amst\z/i]
"Masters"
Method test_set_gender_from_name
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_set_gender_from_name
{
"Athena" => "F",
"Beginner Men" => "M",
"Beginner Women" => "F",
Function makeEditable
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeEditable() {
jQuery('.editable').editable(
function(value, settings) {
var element = jQuery(this);
element.find("input").attr("disabled", "disabled");
Method find_all_for_export
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.find_all_for_export(date = Time.zone.today, include_people = "members_only")
association_number_issuer_id = NumberIssuer.find_by(name: RacingAssociation.current.short_name).id
case include_people
when "members_only"
where_clause = "WHERE (people.member_to >= '#{date}')"
Method show
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def show
discipline = Discipline[params["discipline"]]
if discipline.nil?
flash.now[:warn] = "Could not find discipline \'#{params['discipline']}\'"
return render(:show)
- 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 date_of_birth=
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def date_of_birth=(value)
value = case value
when String
if value[%r{^\d\d/\d\d/\d\d$}]
value.gsub %r{(\d+)/(\d+)/(\d+)}, '19\3/\1/\2'
- 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 assert_same_elements
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def assert_same_elements(expected, actual, message = "")
return if expected.nil? && actual.nil?
if !expected.nil? && actual.nil?
flunk "#{message}\n Expected #{expected} but was 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 category_names
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def category_names
if year < 2016
[
"Athena",
"Beginner Men",
Class RacingAssociation
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class RacingAssociation < ApplicationRecord
ADMIN_TABS = %i[schedule first_aid people teams velodromes categories article_categories articles pages].freeze
# TODO: bmx_numbers? Shouldn"t this be in disciplines?
Method person_params
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def person_params
params.require(:person).permit(
:billing_city,
:billing_country_code,
:billing_first_name,
Method test_min_max
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_min_max
category = Models::Category.new("Athena")
participant = Models::Participant.new(0)
source_events = []
source_results = []
Function bindSelectModal
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bindSelectModal() {
jQuery('button.select-modal').each(function(index, element) {
var button = jQuery(element);
var method = button.data('method');
var objectName = button.data('object-name');
Method calculate!
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calculate!
@logger.debug "Calculator#calculate! source_results: #{source_results.size} rules: #{rules.to_h}"
if rules.place_by == "place"
# place before assigning points
Method source_results_query
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def source_results_query(race)
query = Result
.select(
"distinct results.id as id",
"1 as multiplier",
Method test_group_by_category
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_group_by_category
source_results = []
masters_men = Models::Category.new("Masters Men")
junior_women = Models::Category.new("Junior Women")
rejected_category = Models::Category.new("Category 3")
Method racing_association_params
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def racing_association_params
params.require(:racing_association).permit(
:add_members_from_results,
:administrator_tabs,
:allow_iframes,
Method normalize_case
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.normalize_case(name)
if name
name = name.split.map do |token|
# Calling RacingAssociation.current triggers an infinite loop
if token[/of/i]
- 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 render
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.render(column, row)
time = row[key(column)]
return nil if time.nil?
return time if time.is_a?(String) || time.is_a?(DateTime)
- 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 event
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def event
if params[:key]
year = params[:year] || RacingAssociation.current.effective_year
calculation = Calculations::V3::Calculation.find_by(key: params[:key], year: year)
- 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 index
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def index
if params[:key]
year = params[:year] || Time.zone.today.year
calculation = Calculations::V3::Calculation.find_by(key: params[:key], year: year)
- 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"