Showing 53 of 69 total issues
Method run
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def run
# invert various stats depending on if some flags are set
os_stat = !config[:disable_os_stats]
process_stats = !config[:disable_process_stats]
jvm_stats = !config[:disable_jvm_stats]
- 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 run
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# invert various stats depending on if some flags are set
os_stat = !config[:disable_os_stats]
process_stats = !config[:disable_process_stats]
jvm_stats = !config[:disable_jvm_stats]
Method run
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def run
# If only one cluster is given, no need to check the indexes
ok 'All indexes are unique' if config[:cluster].length == 1
port = ':9200'
- 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 run
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def run
dividend_query = config[:dividend]
divisor_query = config[:divisor]
config.delete(:dividend)
config.delete(:divisor)
- 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 run
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def run
fieldcounts = indexfieldcount
limits = fieldlimitsetting
warnings = {}
- 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 build_request_options
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_request_options
end_time = (Time.now.utc - config[:offset])
options = {
index: indices(end_time),
Method run
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def run
response = client.search(build_request_options)
if config[:invert]
if response['aggregations']['average']['value'] < config[:crit]
critical "Query average (#{response['aggregations']['average']['value']}) was below critical threshold. #{kibana_info}"
- 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 run
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def run
response = client.count(build_request_options)
if config[:invert]
if response['count'] < config[:crit]
critical "Query count (#{response['count']}) was below critical threshold. #{kibana_info}"
- 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 indices
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def indices(end_time)
if !config[:index].nil?
return config[:index]
elsif !config[:date_index].nil?
indices = []
- 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 kibana_info
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def kibana_info
kibana_date_format = '%Y-%m-%dT%H:%M:%S.%LZ'
unless config[:kibana_url].nil?
index = config[:index]
unless config[:date_index].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 kibana_info
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def kibana_info
kibana_date_format = '%Y-%m-%dT%H:%M:%S.%LZ'
unless config[:kibana_url].nil?
index = config[:index]
unless config[:date_index].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 kibana_info
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def kibana_info
kibana_date_format = '%Y-%m-%dT%H:%M:%S.%LZ'
unless config[:kibana_url].nil?
index = config[:index]
unless config[:date_index].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 run
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
dividend_query = config[:dividend]
divisor_query = config[:divisor]
config.delete(:dividend)
config.delete(:divisor)
Method run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run
options = {}
unless config[:level].nil?
options[:level] = config[:level]
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 run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run
if !config[:master_only] || master?
case acquire_status
when 'green'
ok 'Cluster is green'
- 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 es_date_math_string
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def es_date_math_string(end_time)
if config[:minutes_previous].zero? && \
config[:hours_previous].zero? && \
config[:days_previous].zero? && \
config[:weeks_previous].zero? && \
- 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 build_request_options
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build_request_options
end_time = (Time.now.utc - config[:offset])
options = {
index: indices(end_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 build_indices_with_sizes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build_indices_with_sizes
indices_fs_stats = client.indices.stats store: true
pattern_regex = Regexp.new(config[:pattern_regex])
index_with_sizes = indices_fs_stats['indices'].keys.each_with_object({}) do |key, hash|
- 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 indices
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def indices(end_time)
if !config[:index].nil?
return config[:index]
elsif !config[:date_index].nil?
indices = []
Method kibana_info
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def kibana_info
kibana_date_format = '%Y-%m-%dT%H:%M:%S.%LZ'
unless config[:kibana_url].nil?
index = config[:index]
unless config[:date_index].nil?