Showing 4 of 4 total issues
Method post_to_opsgenie
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post_to_opsgenie(action = :create, params = {})
# Override source if specified, default is ip
params['source'] = json_config['source'] if json_config['source']
# Override priority, if specified.
Method tags
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def tags
tags = []
tags += json_config['tags'] if json_config['tags']
tags << 'OverwriteQuietHours' if event_status == 2 && json_config['overwrite_quiet_hours'] == true
tags << 'unknown' if event_status >= 3
- 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 process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process
timeout = json_config[:timeout] || 30
Timeout.timeout(timeout) do
response = case @event['action']
when 'create'
- 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 message
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def message
return @event['notification'] unless @event['notification'].nil?
return default_message if message_template.nil? || !File.exist?(message_template)
custom_message
rescue StandardError
- 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"