Showing 3 of 3 total issues
Method route_for
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.route_for(message)
(@routes || {}).each do |_name, options|
return options if message.command? && message.command == options[:command]
case options[:match]
- 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 verified_request
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def verified_request(env)
req = Rack::Request.new(env)
return false unless req.post? && req.path == @path # only posts at the desired path
return false unless req["text"].is_a?(String) # no empty messages
return false unless req["user_name"] != Bitbot.configuration.user_name # no replies to myself
- 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 route_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def route_for(message)
result = super
return result if result
message.wit ||= @wit.send_message(message.sanitized_text.dup)
- 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"