Showing 97 of 178 total issues
Method sql
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sql
%Q[
SELECT p.participant_id AS id
FROM comments c,
email_preferences p,
Method change
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def change
drop_view :leaderboards
create_view :leaderboards,
"
SELECT s.id,
Method participant_sql
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def participant_sql(participant)
if participant.present?
participant_id = participant.id
email = participant.email
else
Method index
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def index
@current_round_id = current_round_id
if params[:baselines] == 'on'
@search = policy_scope(Submission)
.where(
- 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 remaining_text
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def remaining_text
case challenge.status
when :running, :perpetual
if remaining_time_in_days > 7
"#{pluralize(remaining_time_in_days,'day')} left"
- 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 file_type
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def file_type
if dataset_file.hosting_location == 'External'
if dataset_file.external_url.present?
ext = dataset_file.external_url.split('/')[-1].split('.')[-1]
ext && ext.upcase
- 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
Function show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
show: function(){
if($('#notebook-data').length > 0){
var notebook_json = $('#notebook-data')[0].outerText;
var anchor = document.querySelector("#notebook-holder");
- 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
Avoid deeply nested control flow statements. Open
if (textInputRange.compareEndPoints("EndToEnd", endRange) > -1) {
end = len;
} else {
end = -textInputRange.moveEnd("character", -len);
end += normalizedValue.slice(0, end).split("\n").length - 1;
Method index
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def index
@current_round = current_round
if @challenge.completed?
if params[:post_challenge] == 'on'
@post_challenge = 'on'
- 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 validate_token
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_token(token)
pref_token = EmailPreferencesToken.where(email_preferences_token: token).first
if pref_token.present?
if @participant && @participant.id != pref_token.participant.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
Consider simplifying this complex logical expression. Open
if controller.controller_name == 'registrations' ||
(controller.controller_name == 'challenges' && controller.action_name == 'edit') ||
(controller.controller_name == 'organizers' && controller.action_name == 'edit') ||
(controller.controller_name == 'sessions')
return "class='no-margin-top'"
Consider simplifying this complex logical expression. Open
if (current_participant.first_name.blank? ||
current_participant.last_name.blank? ||
current_participant.affiliation.blank? ||
current_participant.address.blank? ||
current_participant.city.blank? ||
Consider simplifying this complex logical expression. Open
unless (media_large.present? && media_thumbnail.present? && media_content_type.present?) || (media_large.blank? && media_thumbnail.blank? && media_content_type.blank?)
raise MediaFieldsIncomplete
end
Method awesome_link
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def awesome_link(icon_class = nil, link_name = nil, url_options = nil, html_options = nil, &block)
Method build_body
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_body(participant,digest_type,comments,submissions,topics)
Method footer_class
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def footer_class
if controller.controller_name == 'registrations' ||
(controller.controller_name == 'challenges' && controller.action_name == 'edit') ||
(controller.controller_name == 'organizers' && controller.action_name == 'edit') ||
(controller.controller_name == 'sessions')
- 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 vote_link
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def vote_link(votable)
if current_participant
vote_id = participant_vote_id(votable) if current_participant
if vote_id.nil?
upvote_link(votable)
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update
@email_preference.attributes = email_preference_params
if @email_preference.newsletter_change == [false,true]
# from off to on
MailchimpService.new(@participant.id).subscribe
- 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 media_fields_present?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def media_fields_present?
media_large = params[:media_large]
media_thumbnail = params[:media_thumbnail]
media_content_type = params[:media_content_type]
unless (media_large.present? && media_thumbnail.present? && media_content_type.present?) || (media_large.blank? && media_thumbnail.blank? && media_content_type.blank?)
- 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
Avoid too many return
statements within this function. Open
return node.text.replace(/^\s+|\s+$/g, '');