Showing 9 of 9 total issues
Method receive
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def receive(request, response)
routing_to = request.params['to_route'] || request.env['router.params'][:to_route][0].to_s
routing_to_request_method = request.params['request_method'] || request.request_method
if routing_to_request_method =='POST'
json_body = request.params['payload'] || extract_json_from_request(request)
- 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 key_value_build_finder_jenkins
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def key_value_build_finder_jenkins(source_project, project_name)
gkeys = @redis.keys("jenkins:#{project_name}:*")
Lita.logger.info "Jenkins Status found key: #{gkeys.inspect}"
gkeys.each do |key|
Lita.logger.info "Jenkins Status key #{key}"
- 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
Class Gitlab2jenkinsGhp
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Gitlab2jenkinsGhp < Handler
def self.default_config(config)
config.room = '#test'
config.group = 'group_name'
File gitlab2jenkins_ghp.rb
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Lita
module Handlers
class Gitlab2jenkinsGhp < Handler
def self.default_config(config)
Method build_merge_hook
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build_merge_hook(json, data, project_name_target, project_source_id_commit)
redis.set("mr:#{project_name_target}:#{data[:object_attributes][:id]}", json.to_s)
if ['reopened', 'opened'].include? data[:object_attributes][:state]
Lita.logger.info "It's a merge request for #{project_source_id_commit}"
payload_rescue = redis.get("commit:#{project_source_id_commit}")
- 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 receive
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def receive(request, response)
routing_to = request.params['to_route'] || request.env['router.params'][:to_route][0].to_s
routing_to_request_method = request.params['request_method'] || request.request_method
if routing_to_request_method =='POST'
json_body = request.params['payload'] || extract_json_from_request(request)
Avoid deeply nested control flow statements. Open
if message.to_s != 'true'
response['status'] = message
Lita.logger.info "CI Final Status: #{message.to_s}"
end
Method do_mr_change_status
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def do_mr_change_status(request, response, json_body, data, project_name_params) # do_mr_change_status(request, response, json_body, data, project_name_params)
Avoid too many return
statements within this method. Open
return 'error'