Class Intervention
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Intervention < ActiveRecord::Base
DISTRICT_PARENT = :intervention_definition
include LinkAndAttachmentAssets
include ActionView::Helpers::TextHelper
include Stats::Intervention
Method set_defaults_from_definition
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_defaults_from_definition
return unless new_record?
if intervention_definition.blank? || intervention_definition.new_record?
self.frequency ||= Frequency.find_by_title('Weekly')
- 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 intervention_probe_assignment=
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def intervention_probe_assignment=(params)
intervention_probe_assignments.update_all(:enabled => false) #disable all others
params.stringify_keys! unless params.blank? #fix for LH #392
return if params.blank? or (params['probe_definition_id']=='' and params['probe_definition_attributes'].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
Method intervention_probe_assignment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def intervention_probe_assignment(probe_definition_id = nil)
if probe_definition_id
intervention_probe_assignments.find_or_initialize_by_probe_definition_id(probe_definition_id)
else
p=@ipa || intervention_probe_assignments.active.first
- 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"