Showing 20 of 20 total issues
Method getlines
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def getlines(file, pattern=false)
lines = []
if File.readable? file
File.open(file,'r') do |f|
f.each do |l|
- 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 getline
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def getline(file, pattern=false)
if File.readable? file
File.open(file,'r') do |f|
f.each do |l|
line = l.strip
- 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_info
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_info
case os
when :linux
info = meminfo
if info
Method upload
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload
file = @store.record(@data.merge)
command = "#{@config['zabbix']['sender']} -z #{@config['zabbix']['host']} -p #{@config['zabbix']['port']} -T -i #{file}"
ZabbixRubyClient::Log.debug command
begin
Method get_info
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_info
ret = {}
case os
when :linux
info = getline("/proc/stat", "^cpu ")
Method get_info
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_info(interface)
back = {}
case os
when :linux
data = getline("/proc/net/dev", "#{interface}:")
Method collect
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def collect(*args)
host = args[0]
psqlargs = args[1]
dbname = args[2]
# be sure to have this in the config file
Method collect
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def collect(*args)
host = args[0]
mysqlargs = args[1]
mysqlstatus = `mysqladmin #{mysqlargs} extended-status`
if $?.to_i == 0
Method get_info
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_info(disk, device)
info = diskinfo(device)
if info
back = info.split(/\s+/)
case os
Method get_info
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_info
case os
when :linux
info = meminfo
if 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 collect
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def collect(*args)
host = args.shift
app = args.shift
mysqldb = args.shift
mysqlargs = args.shift
Method collect
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def collect(*args)
host = args[0]
ret = get_status
ret['Score'] = get_scores(ret["Scoreboard"])
ret.delete "Scoreboard"
Method run_plugin
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run_plugin(plugin, args = nil)
Plugins.load(plugin) || ZabbixRubyClient::Log.error( "Plugin #{plugin} not found.")
if Plugins.loaded[plugin]
begin
if Plugins.loaded[plugin].respond_to?(:collect)
- 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_status
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_status
ret = {}
open "http://127.0.0.1:8090/nginx_status" do |f|
f.each_line do |line|
ret[:total] = $1 if line =~ /^Active connections:\s+(\d+)/
- 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_info
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_info
ret = {}
case os
when :linux
info = getline("/proc/stat", "^cpu ")
- 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 collect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def collect(*args)
host = args.shift
app = args.shift
mysqldb = args.shift
mysqlargs = args.shift
- 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 upload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def upload
file = @store.record(@data.merge)
command = "#{@config['zabbix']['sender']} -z #{@config['zabbix']['host']} -p #{@config['zabbix']['port']} -T -i #{file}"
ZabbixRubyClient::Log.debug command
begin
- 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_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_info(interface)
back = {}
case os
when :linux
data = getline("/proc/net/dev", "#{interface}:")
- 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_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_info(disk, device)
info = diskinfo(device)
if info
back = info.split(/\s+/)
case os
- 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 collect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def collect(*args)
host = args[0]
psqlargs = args[1]
dbname = args[2]
# be sure to have this in the config file
- 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"