Showing 838 of 1,651 total issues
Perceived complexity for seqs_length is too high. [20/7] Open
def seqs_length(file, format, opts = {})
opts[:gc] = true if opts[:skew]
fh = file =~ /\.gz/ ? Zlib::GzipReader.open(file) : File.open(file, 'r')
l = []
gc = 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
Method has too many lines. [23/10] 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 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 perform is too high. [28.3/15] Open
def perform
cli.ensure_par(tarball: '-o')
unless cli[:tarball] =~ /\.tar\.gz$/
raise 'The tarball path (-o) must have .tar.gz extension'
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
Method has too many lines. [23/10] Open
def each_database_file(dataset, &blk)
ref_db = {
haai: ['01.haai', :aai], aai: ['02.aai', :aai], ani: ['03.ani', :ani]
}
qry_db = {
- 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 run_daemon is too high. [28.6/15] Open
def run_daemon
return if cli[:prepare_and_exit]
cmd = ['daemon', 'run', '-P', cli[:outdir], '--shutdown-when-done']
cmd += ['--json', cli[:daemon_json]] if cli[:daemon_json]
- 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 parse_cli is too high. [28.07/15] Open
def parse_cli
cli.opt_common = false
cli.parse do |opt|
descriptions = cli.class.TASK_DESC.keep_if { |k, v| k != :generic }
opt.separator MiGA::MiGA.tabulate(
- 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
File remote_dataset.rb
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'miga/taxonomy'
require 'miga/remote_dataset/download'
##
# MiGA representation of datasets with data in remote locations.
- Create a ticketCreate a ticket
Method has too many lines. [22/10] Open
def test_seqs_length_fasta
c = ">a\nACA\n>b\nACG\n>c\nACTGA\n>d\nGTGAG\n"
f = helper_write_file(c)
o = MiGA::MiGA.seqs_length(f, :fasta)
assert_equal(4.0, o[:avg])
- 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. [22/10] Open
def test_alternative
tx = MiGA::Taxonomy.new('ns:a s:Arnie', nil,
['ns:b s:Bernie', 'ns:c s:Cornie', 's:Darnie'])
# Fields
assert_equal('ns:a s:Arnie', tx.to_s)
- 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. [22/10] Confirmed
def save_to(project, name = nil, is_ref = true, metadata_def = {})
name ||= ids.join('_').miga_name
project = MiGA::Project.new(project) if project.is_a? String
MiGA::Dataset.exist?(project, name) and
raise "Dataset #{name} exists in the project, aborting..."
- 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. [22/10] Open
def flush!
# Check for finished jobs
l_say(2, 'Checking for finished jobs')
@jobs_running.select! do |job|
ongoing =
- 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. [22/10] Open
def aai_pvalues(aai, test, opts = {})
y = {}
Zlib::GzipReader.open(aai_path(test, opts)) do |fh|
keys = nil
fh.each_line do |ln|
- 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. [22/10] Open
def add_result_clade_finding(base, _opts)
if result_files_exist?(base, %w[.empty])
r = MiGA::Result.new("#{base}.json")
r.add_file(:empty, 'miga-project.empty')
return r
- 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. [22/10] Open
def runopts(k, v = nil, force = false)
k = k.to_sym
unless v.nil?
case k
when :latency, :maxjobs, :ppn, :ppn_project, :format_version, :verbosity,
- 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 perform is too high. [27.37/15] Open
def perform
cli.ensure_par(path: '-p')
k_opts = %i[
json latency wait_for keep_inactive trust_timestamp name dry exclude
]
- 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. [22/10] Open
def cli_filters(opt)
opt.on(
'--exclude PATH',
'A file with dataset names to exclude'
) { |v| cli[:exclude] = v }
- 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 configure_daemon is too high. [27.66/15] Open
def configure_daemon
cli.puts 'Default daemon configuration:'
daemon_f = File.expand_path('.miga_daemon.json', ENV['MIGA_HOME'])
unless File.exist?(daemon_f) and cli.ask_user(
'A template daemon already exists, do you want to preserve it?',
- 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 check_db is too high. [27.95/15] Open
def check_db(cli)
cli.say 'Checking integrity of databases'
p = cli.load_project
n = p.dataset_names.size
(0 .. cli[:threads] - 1).map do |i|
- 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. [22/10] Open
def parse_cli
cli.defaults = { add: false, ref: true }
cli.parse do |opt|
cli.opt_object(opt, [:project, :dataset_type])
opt.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. [22/10] Open
def perform
# Quick check when the database is not an alias
dir = File.join(cli[:local], cli[:database].to_s)
if !cli[:overwrite] && Dir.exist?(dir)
cli.puts "Database exists: #{dir}"
- 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.