Showing 6 of 10 total issues
Method set_theme
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def set_theme
session["run_count"] = 0 unless session["run_count"].present?
session["run_count"] += 1
if session["run_count"] <= 1
- 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 setup_subscriptions
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def setup_subscriptions
# setup the equivalend of event listeners to build instance variables.
# exactly what ActonController::TestCase does
@_partials = Hash.new(0)
- 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 setup_subscriptions
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_subscriptions
# setup the equivalend of event listeners to build instance variables.
# exactly what ActonController::TestCase does
@_partials = Hash.new(0)
Method set_theme
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_theme
session["run_count"] = 0 unless session["run_count"].present?
session["run_count"] += 1
if session["run_count"] <= 1
Method build_variables
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_variables
@relevant_instance_varaibles = controller
.instance_variable_names.reject {|v| v[/@_/] || v == "@marked_for_same_origin_verification"}
@instance_variable_objects = {}
relevant_instance_varaibles.each do |v|
- 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 deeply nested control flow statements. Open
unless ["session_id", "_csrf_token"].include?(k)
session[k] ||= systeem_session[k]
end