Showing 1,637 of 1,651 total issues
Assignment Branch Condition size for test_activate is too high. [18.03/15] Open
def test_activate
d = dataset
assert_equal(:incomplete, d.status)
assert_predicate(d, :active?)
d.inactivate! 'Too annoying'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for test_bypass_maintenance is too high. [18.11/15] Open
def test_bypass_maintenance
# Default (run maintenance)
d = daemon(0)
d.runopts(:latency, 0, true)
capture_stderr { d.in_loop }
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [13/10] Open
def test_in_loop
declare_forks
lair = MiGA::Lair.new(tmpdir, name: 'Oh')
child = lair.start(['--shush'])
assert_not_nil(child)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [13/10] Open
def test_in_loop
p = project
d = daemon
d.runopts(:latency, 0, true)
assert_nil(d.loop_i)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [13/10] Open
def test_options
d1 = daemon
assert_respond_to(d1, :default_options)
assert_equal(:normal, d1.default_options[:dir_mode])
assert_equal(2, d1.runopts(:latency))
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [13/10] Open
def test_launch_job_ssh
d1 = daemon(1)
t = tmpfile('launch_job_ssh')
d1.runopts(:type, 'ssh')
d1.runopts(:cmd, "echo {{task_name}} > '#{t}'")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for test_show_log is too high. [18.03/15] Open
def test_show_log
d = daemon
assert(d.show_log?)
d.runopts(:show_log, false)
assert(!d.show_log?)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [13/10] Open
def helper_datasets_with_results(n = 1, project_i = 0)
p1 = project(project_i)
Array.new(n) do |i|
d = "d#{i}"
FileUtils.touch(
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [13/10] Open
def initialize(argv)
@data = {}
@defaults = { verbose: false, tabular: false }
@opt_common = true
@original_argv = argv.dup
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for ask_user is too high. [9/6] Open
def ask_user(question, default = nil, answers = nil, force = false)
ans = " (#{answers.join(' / ')})" unless answers.nil?
dft = " [#{default}]" unless default.nil?
print "#{question}#{ans}#{dft} > "
if self[:auto] && !force
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [13/10] Open
def test_update_format_0
f = tmpfile('daemon.json')
File.open(f, 'w') do |fh|
fh.puts(
<<~DAEMON
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [13/10] Open
def update_format_0
{
cmd: %w[script vars cpus log task_name],
var: %w[key value],
alive: %w[pid],
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for get_job is too high. [18.44/15] Open
def get_job(job, ds = nil)
(jobs_to_run + jobs_running).find do |j|
if ds.nil?
j[:ds].nil? && j[:job] == job
else
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [13/10] Open
def compute_stats_taxonomy
stats = {}
return stats unless file_path(:intax_test)
File.open(file_path(:intax_test), 'r') do |fh|
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [13/10] Open
def fix_essential_genes_by_domain
return if file_path(:raw_report)
tax = source.metadata[:tax]
return unless tax.nil? || %w[Archaea Bacteria].include?(tax[:d])
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Perceived complexity for get_ncbi_taxonomy is too high. [10/7] Open
def get_ncbi_taxonomy
tax_id = get_ncbi_taxid or return
if self.class.ncbi_taxonomy_dump?
return self.class.taxonomy_from_ncbi_dump(tax_id)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Perceived complexity for ask_user is too high. [10/7] Open
def ask_user(question, default = nil, answers = nil, force = false)
ans = " (#{answers.join(' / ')})" unless answers.nil?
dft = " [#{default}]" unless default.nil?
print "#{question}#{ans}#{dft} > "
if self[:auto] && !force
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Assignment Branch Condition size for to_tab is too high. [18.68/15] Open
def to_tab(unknown, indent = 0)
o = ''
if unknown or not datasets.empty? or not name.nil?
o = "#{' ' * indent}#{tax_str}: #{datasets_count}\n"
end
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Cyclomatic complexity for parse is too high. [9/6] Open
def parse(path, opts = {})
opts = default_opts(opts)
# Read JSON
cont = path
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Assignment Branch Condition size for unregistered_datasets is too high. [18.68/15] Open
def unregistered_datasets
datasets = []
MiGA::Dataset.RESULT_DIRS.values.each do |dir|
dir_p = "#{path}/data/#{dir}"
next unless Dir.exist? dir_p
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric