Showing 6 of 6 total issues
Method find_from_file
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_from_file(file = '/etc/xymon/xymonclient.cfg')
result = []
open(file, 'r').read.each_line do |line|
next unless line =~ /^XYMSRV=/ || line =~ /^XYMSERVERS=/
ip = line.scan(/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,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 status
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def status
@timestamp = Time.now
return 'clear' unless @enabled
items_status = @items.map do |_key, value|
if value.status == 'purple'
- 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 _send_to_all
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _send_to_all(message)
fail_srv = []
send_result = true
@servers.each do |server|
retry_count = 0
- 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 status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def status
@status = \
if !@enabled
'clear'
elsif Time.now - @time > \
- 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 status
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def status(host, service, status, message, lifetime = '30m')
Method status
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def status
@status = \
if !@enabled
'clear'
elsif Time.now - @time > \
- 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"