Showing 16 of 27 total issues
File connect.rb
has 500 lines of code (exceeds 250 allowed). Consider refactoring. Open
use_inline_resources
provides :zabbix_connect if defined? provides
action :make do
Method create_hosts
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def create_hosts
get_hosts do |host|
fqdn, values = host['zabbix']['hosts'].to_a.first
next unless values
- 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 create_actions
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def create_actions
get_hosts do |host|
_, values = host['zabbix']['hosts'].to_a.first
(values['actions'] || []).each do |name, data|
filter = data['filter'].to_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 create_applications
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_applications
get_hosts do |host|
fqdn, values = host['zabbix']['hosts'].to_a.first
tmp = @@zbx.query(
method: 'host.get',
Method create_screens
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_screens
get_hosts do |host|
fqdn, values = host['zabbix']['hosts'].to_a.first
host_id = @@zbx.query(
method: 'host.get',
Method create_hosts
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_hosts
get_hosts do |host|
fqdn, values = host['zabbix']['hosts'].to_a.first
next unless values
Method create_import_templates
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_import_templates
get_hosts do |host|
_, values = host['zabbix']['hosts'].to_a.first if host['zabbix']['hosts']
values ||= Hash.new([])
Method create_actions
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_actions
get_hosts do |host|
_, values = host['zabbix']['hosts'].to_a.first
(values['actions'] || []).each do |name, data|
filter = data['filter'].to_hash
Method create_applications
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create_applications
get_hosts do |host|
fqdn, values = host['zabbix']['hosts'].to_a.first
tmp = @@zbx.query(
method: 'host.get',
- 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 create_screens
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create_screens
get_hosts do |host|
fqdn, values = host['zabbix']['hosts'].to_a.first
host_id = @@zbx.query(
method: 'host.get',
- 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 create_graphs
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_graphs
get_hosts do |host|
fqdn, values = host['zabbix']['hosts'].to_a.first
host_id = @@zbx.query(
method: 'host.get',
Method create_user_macros
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_user_macros
get_hosts do |host|
_, values = host['zabbix']['hosts'].to_a.first
host_id = @@zbx.query(
method: 'host.get',
Method to_hash
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_hash
case @type
when :trigger, :host_group
value = @value
when :trigger_value
- 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_hosts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_hosts
if Chef::Config[:solo] || ENV['TEST_KITCHEN']
yield node
else
search(:node, 'hosts:*').each do |host|
- 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 check_zabbix_db
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_zabbix_db(db_connect_string)
db_vendor = new_resource.db_vendor
cmd_key = db_vendor == 'mysql' ? '-N -B -e' : '-c'
check_db_flag = false
# Check connect to database
- 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 create_templates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_templates
get_hosts do |host|
_, values = host['zabbix']['hosts'].to_a.first
(values['templates'] || []).each do |template, hostname|
- 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"