Showing 4 of 4 total issues
Method find_deprecated_cookies
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_deprecated_cookies(cookies, now)
deprecated_cookies = {}
cookies.each do |cookie_name, value|
# Skip any cookie that does not have the 'eeny_meeny_' prefix
next unless cookie_name.to_s.start_with?(EenyMeeny::Cookie::EXPERIMENT_PREFIX)
- 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 prepare_experiment
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare_experiment(env, cookies, new_cookies, query_parameters, experiment)
Method prepare_experiment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare_experiment(env, cookies, new_cookies, query_parameters, experiment)
# Trigger experiment through query parameters
cookie_name = EenyMeeny::Cookie.cookie_name(experiment)
has_experiment_trigger = EenyMeeny.config.query_parameters[:experiment] && query_parameters.key?(cookie_name)
# Skip experiments that already have a cookie
- 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 call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
cookies = Rack::Utils.parse_query(env[HTTP_COOKIE],';,') { |s| Rack::Utils.unescape(s) rescue s }
query_parameters = query_hash(env)
now = Time.zone.now
new_cookies = {}
- 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"