Showing 1,637 of 1,651 total issues
Assignment Branch Condition size for test_single_raw_reads is too high. [20.22/15] Open
def test_single_raw_reads
dir = 'data/01.raw_reads'
fq = file_path(dir, '.1.fastq')
File.open(fq, 'w') { |fh| fh.puts '@1', 'ACTAC', '+', '####' }
touch_done(dir)
- 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. [15/10] Open
def test_dates
r = dataset.add_result(:trimmed_reads)
assert_nil(r.done_at)
assert_nil(r.started_at)
tf = File.join(
- 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. [15/10] Open
def test_overwrite_result
r = dataset.add_result(:trimmed_reads)
r[:ephemeral] = '@'
r[:versions] = { you: 'best' }
r.save
- 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. [15/10] Open
def save
return if self[:never_save]
return if !saved_hash.nil? && saved_hash == data.hash
MiGA::MiGA.DEBUG "Metadata.save #{path}"
- 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. [15/10] Open
def test_load_status
d1 = daemon
p1 = project
assert_equal(0, d1.jobs_running.size)
assert_nil(d1.load_status)
- 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. [15/10] Open
def test_terminate
d = daemon
assert_not_predicate(d, :active?)
assert_path_not_exist(d.alive_file)
assert_path_not_exist(d.terminated_file)
- 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. [15/10] Open
def test_next_host
d1 = daemon
f = tmpfile('nodes.txt')
File.open(f, 'w') { |h| h.puts 'localhost' }
assert_equal(true, d1.next_host)
- 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. [15/10] Open
def test_debug
assert_respond_to(MiGA::MiGA, :DEBUG)
assert_respond_to(MiGA::MiGA, :DEBUG_ON)
assert_respond_to(MiGA::MiGA, :DEBUG_OFF)
MiGA::MiGA.DEBUG_ON
- 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. [15/10] Open
def test_load
md1 = MiGA::Metadata.new(tmpfile('md_load.json'), { t: 1 })
assert_equal(1, md1[:t])
declare_forks
- 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_add_hook is too high. [20.22/15] Open
def test_add_hook
assert_nil(dataset.hooks[:on_remove])
assert_equal(1, dataset.hooks[:on_save].size)
dataset.add_hook(:on_save, :run_lambda, Proc.new { $counter += 1 })
assert_equal(2, dataset.hooks[:on_save].size)
- 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. [15/10] Confirmed
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 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. [15/10] Open
def compute_stats_raw_reads
stats = {}
seq_opts = { gc: true, x: true, skew: true }
if self[:files][:pair1].nil?
s = MiGA::MiGA.seqs_length(file_path(:single), :fastq, seq_opts)
- 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. [15/10] Open
def compute_stats_assembly
s = MiGA::MiGA.seqs_length(
file_path(:largecontigs), :fasta,
n50: true, gc: true, x: true, skew: true
)
- 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 compute_stats_essential_genes is too high. [11/6] Open
def compute_stats_essential_genes
stats = {}
if source.multi?
stats = { median_copies: 0, mean_copies: 0 }
File.open(file_path(:report), 'r') do |fh|
- 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.
Perceived complexity for option_from_string is too high. [12/7] Open
def option_from_string(key, value)
opt = assert_has_option(key)
if ['', 'nil'].include?(value)
nil
- 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 download_file_ftp is too high. [12/7] Open
def download_file_ftp(connection, file = nil, target = nil)
# Open connection unless passed
close_conn = false
if connection.is_a?(String) || connection.is_a?(Symbol) ||
connection.is_a?(URI)
- 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
Method has too many lines. [15/10] Open
def load_ncbi_taxonomy_dump
return unless cli[:ncbi_taxonomy_dump]
if cli[:ncbi_taxonomy_dump] == true
cli.say 'Downloading and reading NCBI Taxonomy dump'
- 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 download_entries is too high. [12/7] Open
def download_entries(ds, p)
cli.say "Downloading #{ds.size} " + (ds.size == 1 ? 'entry' : 'entries')
p.do_not_save = true if cli[:save_every] != 1
ignore = !cli[:ignore_until].nil?
downloaded = 0
- 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
Cyclomatic complexity for add_metadata is too high. [11/6] Open
def add_metadata(obj, cli = self)
raise "Unsupported object: #{obj.class}" unless obj.respond_to? :metadata
(cli[:metadata] || '').split(',').each do |pair|
(k, v) = pair.split('=')
- 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. [15/10] Open
def check_configuration_script(rc_fh)
unless File.exist? cli[:config]
cli[:config] = cli.ask_user(
'Is there a script I need to load at startup?',
cli[:config]
- 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.