Showing 42 of 7,746 total issues
Method respond
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def respond
case event_codename
when "custom"
# available custom 1/15/2017 0800 01/15/2021 Work
unless start_time.is_a? Time and end_time.is_a? Time
Method valid_people_numbers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def valid_people_numbers
if (minimum_people.present? and maximum_people.present? and desired_people.present?)
if maximum_people < minimum_people
errors.add :maximum_people, "must be greater than or equal to 'minimum_people'"
end
- 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 create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
@notification = Notification.new(notification_params)
if @notification.save
if @notification.status == "Active"
begin
- 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 performSearch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function performSearch(data, regexps, queries, highlighters, state) {
Method staffing_level
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def staffing_level
return STATUS_CHOICES_ARRAY[5] if status == 'Cancelled'
statuses = requirements.map { |r| Requirement::STATUS_CHOICES[r.status] }
sorted = statuses.uniq.sort
- 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 method. Open
return 'label label-default'
Avoid too many return
statements within this method. Open
return STATUS_CHOICES_ARRAY[3] if sorted[0] == 3 # Satisfied
Avoid too many return
statements within this method. Open
return nil
Avoid too many return
statements within this method. Open
return 'label label-danger'
Avoid too many return
statements within this method. Open
return STATUS_CHOICES_ARRAY[2] if sorted[0] == 2 # Adequate
Avoid too many return
statements within this method. Open
return 'Empty'
Avoid too many return
statements within this method. Open
return STATUS_CHOICES_ARRAY[4] if sorted == [4] # Full
Avoid too many return
statements within this method. Open
return 'label label-default'
Avoid too many return
statements within this method. Open
return 'label label-default'
Method verify
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify
if @timecard.status == 'Unverified'
@timecard.status = 'Verified'
if @timecard.save
respond_to do |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 change
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def change
unless column_exists? :notifications, :subject
add_column :notifications, :subject, :string
end
unless column_exists? :notifications, :body
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(current_user)
current_user ||= User.new
roles = current_user.roles.map {|x| x.to_s}
if roles.blank?
cannot :manage, :all
- 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 add_class_and_confirmation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_class_and_confirmation(default_class, default_delete_class, default_confirm_delete_msg, html_options)
if html_options[:method] == :delete
html_options[:class] ||= default_delete_class
html_options[:data] ||= { confirm: default_confirm_delete_msg }
html_options[:data][:confirm] ||= default_confirm_delete_msg
- 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 hookSearch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function hookSearch() {
var input = $('#search-field').eq(0);
var result = $('#search-results').eq(0);
$(result).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 availability_status_label
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def availability_status_label(a, event = nil)
if a.class.to_s=='Assignment'
content_tag(:span, 'Assigned', class: 'label label-info')
elsif a.partially_available?(event)
content_tag(:span, a.status == "Available" ? "Partially Available" : a.status,
- 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"