Method format_criteria_value
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def format_criteria_value(criteria_options, value, html=true)
if value.blank?
"[#{l(:label_none)}]"
elsif k = criteria_options[:klass]
obj = k.find_by_id(value.to_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 report_criteria_to_csv
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def report_criteria_to_csv(csv, available_criteria, columns, criteria, periods, hours, level=0)
hours.collect {|h| h[criteria[level]].to_s}.uniq.each do |value|
hours_for_value = select_hours(hours, criteria[level], value)
next if hours_for_value.empty?
- 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 report_criteria_to_csv
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def report_criteria_to_csv(csv, available_criteria, columns, criteria, periods, hours, level=0)
Method activity_collection_for_select_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def activity_collection_for_select_options(time_entry=nil, project=nil)
project ||= time_entry.try(:project)
project ||= @project
activities = TimeEntryActivity.available_activities(project)
- 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"