Showing 6 of 10 total issues
Method dry_run
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def dry_run(api_url, routing_key, uri, payload)
return unless config[:dryrun]
puts 'Dryrun: reporting settings and exiting'
puts " option settingsname set: #{config[:settingsname]}"
- 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 handle
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle
# validate that we have a client defined
unless defined?(@event['client']) && !@event['client']['name'].nil?
raise 'victorops.rb sensu client not found or has no name. If using with Sensu Go please ensure you have enabled event mapping'
end
Method dry_run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dry_run(api_url, routing_key, uri, payload)
return unless config[:dryrun]
puts 'Dryrun: reporting settings and exiting'
puts " option settingsname set: #{config[:settingsname]}"
Method handle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def handle
# validate that we have a client defined
unless defined?(@event['client']) && !@event['client']['name'].nil?
raise 'victorops.rb sensu client not found or has no name. If using with Sensu Go please ensure you have enabled event mapping'
end
- 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 set_api_url
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_api_url
# validate that we have an api url - environment variables take precedence
api_url = ENV['VICTOROPS_API_URL']
api_url = config[:api_url] if api_url.nil?
if api_url.nil?
- 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 set_routing_key
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def set_routing_key
# validate that we have a routing key - environment variables take precedence
routing_key = ENV['VICTOROPS_ROUTING_KEY']
routing_key = config[:routing_key] if routing_key.nil?
if routing_key.nil?
- 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"