Showing 6 of 6 total issues
Method _call
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def _call(env)
# retrieve the request object
request = Rack::Request.new(env)
# if the request is a post to bot webhhok
- 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 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _call(env)
# retrieve the request object
request = Rack::Request.new(env)
# if the request is a post to bot webhhok
Method process_json_message
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def process_json_message(message, params)
message[:chat_id] = params.message.chat.id unless message.include?(:chat_id) || message.include?('chat_id')
['reply_markup', :reply_markup].each do |item|
message[item] = message[item].to_json if message.include?(item)
- 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 get_command
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_command(params)
if params['message']
unless params.message['text'].nil?
# build path based on message
# - get only message part of post params
- 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 initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def initialize(app, &_block)
TeleBot.init(self)
# save the app var
@app = app
- 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
if body.is_a? Hash
process_hash_message(body.clone, params)
body = Array.new(1) { '' }
headers['Content-Length'] = '0'
else