Method update_values
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def update_values
@checklist = Checklist.find params[:id]
@checklist.grade_callback = params[:checklist][:grade_callback]
@checklist.title = params[:checklist][:title]
@checklist.save
- 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 yaml_to_topics
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def yaml_to_topics(yaml)
ordering = 1
topics = YAML.load(yaml).map do |thash|
thash = parse_ids_from :topic, thash
if thash.has_key? "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
Method update_values
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_values
@checklist = Checklist.find params[:id]
@checklist.grade_callback = params[:checklist][:grade_callback]
@checklist.title = params[:checklist][:title]
@checklist.save
File checklists_controller.rb
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ChecklistsController < ApplicationController
def index
@checklists = Checklist.order :title
end
Method topics_to_yaml
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def topics_to_yaml (topics)
StyledYAML.dump format_nice(topics.map{ |topic|
ret = topic.attributes.reject {|key,value|
%w(ordering checklist_id scoretype_id).include? key or value.nil?
}
- 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 yaml_to_topics
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def yaml_to_topics(yaml)
ordering = 1
topics = YAML.load(yaml).map do |thash|
thash = parse_ids_from :topic, thash
if thash.has_key? "id"
Method format_nice
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def format_nice (coll)
if coll.is_a? Hash
coll.each do |key, value|
coll[key] = format_nice(value)
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"