Showing 48 of 112 total issues
Method work
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def work
ended = []
@jobs.delete_if { |job| ended << job unless job.alive? }
ended.each { |job| process job }
@jobs.work
- 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 credentials
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def credentials(node)
Proc.new do |_url, username_from_url, _allowed_types| # rubocop:disable Style/Proc
git_user = cfg.has_key?('username') ? cfg.username : (username_from_url || 'git')
if cfg.has_key?('password')
log "Authenticating using username and password as '#{git_user}'", :debug
- 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 clean
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def clean(cfg)
out = []
cfg.each_line do |line|
next if line =~ /date \d{4}:\d{2}:\d{2}/
next if line =~ /time \d{2}:\d{2}:\d{2}/
- 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 validate_cfg!
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def validate_cfg!
# Syntax check
if cfg.has_key? "timeout"
@timeout = cfg.timeout
raise "invalid timeout value" unless @timeout.is_a?(Integer) &&
- 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_hook
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def run_hook(ctx)
return unless ctx.node
return unless ctx.event.to_s == "post_store"
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 load
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.load(cmd_opts = {})
usrdir = File.expand_path(cmd_opts[:home_dir] || Oxidized::Config::ROOT)
cfgfile = cmd_opts[:config_file] || 'config'
# configuration file with full path as a class instance variable
@configfile = File.join(usrdir, cfgfile)
Method run_hook
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def run_hook(ctx)
return unless ctx.node
return unless ctx.event.to_s == "post_store"
log "Connecting to slack"
- 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 update
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update(repo, file, data)
return if data.empty?
if @opt[:group]
if @cfg.single_repo?
- 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_hook
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run_hook(ctx)
unless ctx.node.repo
log "Oxidized output is not git, can't push to remote", :error
return
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 load
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def load(_node_want = nil)
nodes = []
open_file.each_line do |line|
next if line =~ /^\s*#/
- 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_input
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_input(input)
rescue_fail = {}
[input.class::RESCUE_FAIL, input.class.superclass::RESCUE_FAIL].each do |hash|
hash.each do |level, errors|
errors.each do |err|
Method clean
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def clean(cfg)
out = []
skip_blocks = 0
cfg.each_line do |line|
# If this is a stackable switch we should skip this block of information
- 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 shell_open
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def shell_open(ssh)
@ses = ssh.open_channel do |ch|
ch.on_data do |_ch, data|
if Oxidized.config.input.debug?
@log.print data
- 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 make_ssh_opts
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def make_ssh_opts
secure = Oxidized.config.input.ssh.secure?
ssh_opts = {
number_of_password_prompts: 0,
keepalive: vars(:ssh_no_keepalive) ? false : true,
- 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 clean
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def clean(cfg)
out = []
skip_blocks = 0
cfg.each_line do |line|
# If this is a stackable switch we should skip this block of information
- 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 oxidized_expect
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def oxidized_expect(options) ## rubocop:disable Metrics/PerceivedComplexity
model = @options["Model"]
@log = @options["Log"]
expects = [options[:expect]].flatten
- 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 clean
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def clean(cfg)
out = []
cfg.each_line do |line|
# drop the temperature, fan speed and voltage, which change each run
next if line =~ /Output \d Config/i
- 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 oxidized_expect
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def oxidized_expect(options) ## rubocop:disable Metrics/PerceivedComplexity
model = @options["Model"]
@log = @options["Log"]
expects = [options[:expect]].flatten
Method run_hook
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_hook(ctx)
unless ctx.node.repo
log "Oxidized output is not git, can't push to remote", :error
return
end
Method run_hook
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def run_hook(ctx)
return unless ctx.node
return unless ctx.event.to_s == "post_store"
log "Connecting to Cisco Spark"
- 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"