Method update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update
update_params = rule_params
update_params[:name] = update_params[:name].first if update_params[:name]
if @rule.filter.content_type == ContentViewPackageFilter::CONTENT_TYPE
- 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 process_errata_ids
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_errata_ids(select_all_params)
if select_all_params[:included][:ids].blank?
select_all_params[:excluded][:ids] ||= [] if select_all_params[:excluded][:ids].nil?
current_errata_ids = @filter.erratum_rules.map(&:errata_id) + select_all_params[:excluded][:ids]
query = Erratum
- 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 rule_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rule_params
unless @rule_params
if params[:content_view_filter_rule][:errata_ids].is_a?(Hash)
ids = process_errata_ids(params[:content_view_filter_rule][:errata_ids])
params[:content_view_filter_rule][:errata_ids] = ids
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def create
rule_clazz = ContentViewFilter.rule_class_for(@filter)
rules = (rule_params[:name] || []).map do |name|
rule_clazz.create!(rule_params.except(:name).merge(:filter => @filter, name: name))
- 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"