Showing 53 of 69 total issues
Method get_es_resource
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_es_resource(resource)
headers = {}
if config[:user] && config[:password]
auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
headers = { 'Authorization' => auth }
Method run
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
fieldcounts = indexfieldcount
limits = fieldlimitsetting
warnings = {}
Method get_es_resource
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_es_resource(resource)
headers = {}
if config[:user] && config[:password]
auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
headers = { 'Authorization' => auth }
Method run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
es_version = Gem::Version.new(acquire_es_version)
if es_version >= Gem::Version.new('1.0.0')
ln = get_es_resource('/_nodes/_local')
Method run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run
stats = acquire_status
if stats.code == 200
if config[:all]
- 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 indexfieldcount
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def indexfieldcount
index_field_count = {}
mappings = client.indices.get_mapping index: config[:index], type: config[:types]
mappings.each do |index, index_mapping|
unless index_mapping['mappings'].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 client
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def client
transport_class = nil
if config[:transport] == 'AWS'
transport_class = Elasticsearch::Transport::Transport::HTTP::AWS
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 acquire_heap_usage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def acquire_heap_usage(heap_used, heap_max, node_name)
if config[:percentage]
heap_usage = ((100 * heap_used) / heap_max).to_i
output = if config[:all]
"Node #{node_name}: Heap used in bytes #{heap_used} (#{heap_usage}% full)\n"
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def run
node_fs_stats = client.nodes.stats metric: 'fs,indices'
nodes_being_used = node_fs_stats['nodes'].values.select { |node| node['indices']['store']['size_in_bytes'] > 0 }
# TODO: come back and cleanup all these rubocop disables with a little refactor
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def run
stats = acquire_stats
status = { crit: '', warn: '', ok: '' }
# Check all the nodes in the cluster, alert if any of the nodes have heap usage above thresholds
- 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 get_es_resource
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_es_resource(resource)
headers = {}
if config[:user] && config[:password]
auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
headers = { 'Authorization' => auth }
- 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 acquire_stats
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def acquire_stats
if Gem::Version.new(acquire_es_version) >= Gem::Version.new('1.0.0')
if config[:all]
acquire_es_resource('/_nodes/stats')
else
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def run
if config[:allow_non_master] || master?
transient = get_status('transient')
persistent = get_status('persistent')
- 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"