Showing 838 of 1,651 total issues
Method has too many lines. [21/10] Open
def perform
# Input data
ref_db = reference_db
norun = %w[
haai_distances aai_distances ani_distances clade_finding
- 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 add_metadata
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. 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
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 parse_cli
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_cli
cli.defaults = { daemon_opts: [] }
cli.expect_operation = true
cli.parse do |opt|
opt.separator 'Available operations:'
- Create a ticketCreate a ticket
Method parse_cli
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_cli
cli.defaults = {
query: false, universe: :ncbi, db: :nuccore, get_md: false, only_md: false
}
cli.parse do |opt|
- Create a ticketCreate a ticket
Method has too many lines. [20/10] Confirmed
def test_import_dataset
p1 = project
d = p1.add_dataset('d1')
File.open(
File.join(p1.path, 'data', '01.raw_reads', "#{d.name}.1.fastq"), 'w'
- 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. [20/10] Open
def test_daemon_operations
d = TestWithDaemon.new(tmpdir)
FileUtils.touch(d.output_file)
assert_not_predicate(d, :active?)
- 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_flush is too high. [25.5/15] Open
def test_flush
d1 = daemon
p1 = project
helper_datasets_with_results
p1.add_dataset(MiGA::Dataset.new(p1, 'd1').name)
- 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_in_loop is too high. [25.32/15] 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 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_datasets is too high. [25.46/15] Open
def check_datasets
l_say(2, 'Checking datasets')
o = false
project.each_dataset do |ds|
next unless ds.status == :incomplete
- 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. [20/10] Confirmed
def ncbi_asm_acc2id(acc, retrials = 3)
return acc if acc =~ /^\d+$/
search_doc = MiGA::Json.parse(
download(:ncbi_search, :assembly, acc, :json),
- 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. [20/10] Open
def load_status
f_path = File.join(daemon_home, 'status.json')
return unless File.size? f_path
say 'Loading previous status in daemon/status.json:'
- 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. [20/10] Open
def perform
cli.ensure_par(index: '-i')
ds = cli.load_and_filter_datasets
cli.say 'Indexing taxonomy'
- 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. [20/10] Open
def read_distances
p = cli.load_project
cli[:metric] ||= p.clade? ? 'ani' : 'aai'
res_n = "#{cli[:metric]}_distances"
cli.say "Reading distances: 1-#{cli[:metric].upcase}"
- 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. [20/10] Open
def perform
cli.ensure_par(result: '-r')
obj = cli.load_project_or_dataset
cli.say "Registering result: #{cli[:result]}"
r = obj.add_result(cli[:result], true, force: cli[:force])
- 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. [20/10] Open
def remote_list
if cli[:ncbi_list_json] && File.size?(cli[:ncbi_list_json])
return read_ncbi_list_json(cli[:ncbi_list_json])
end
- 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. [25.48/15] Open
def perform
cli.ensure_par(result: '-r')
obj = cli.load_project_or_dataset
cli.say "Registering result: #{cli[:result]}"
r = obj.add_result(cli[:result], true, force: cli[:force])
- 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 load_ncbi_taxonomy_dump is too high. [25.26/15] 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 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. [20/10] Open
def remote_list
cli.say 'Downloading genome list'
extra = { sp_reps_only: cli[:reference].to_s }
json = MiGA::RemoteDataset.download(
:gtdb, :taxon, cli[:taxon], :genomes, nil, extra
- 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. [20/10] Open
def check_files(cli)
cli.say 'Looking for outdated files in results'
n, k = cli.load_project.dataset_names.size, 0
cli.load_project.each_dataset do |d|
cli.advance('Datasets:', k += 1, n, false)
- 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. [20/10] Open
def check_rdp_classifier
cli.print 'Looking for RDP classifier... '
miga_db = File.join(ENV['MIGA_HOME'], '.miga_db')
file = 'classifier.jar'
path = File.join(miga_db, 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.