Showing 1,586 of 1,600 total issues
Assignment Branch Condition size for test_seqs_length_fasta is too high. [36.67/15] 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 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_check_datasets is too high. [36.22/15] Open
def test_check_datasets
p = project
d = daemon
d.runopts(:maxjobs, 0, true)
assert_empty(d.jobs_to_run)
- 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. [31/10] Open
def test_start
p = project
d = daemon
d.runopts(:latency, 0, true)
assert_equal(0, d.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.
Assignment Branch Condition size for job_cmd is too high. [36.4/15] Open
def job_cmd(to_run)
what = to_run[:ds].nil? ? :project : :dataset
vars = {
'PROJECT' => project.path,
'RUNTYPE' => runopts_for(:type, what),
- 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. [31/10] Open
def load_and_filter_datasets(silent = false)
return @objects[:filtered_datasets] unless @objects[:filtered_datasets].nil?
say 'Listing datasets'
ds =
- 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. [31/10] Open
def perform
p = cli.load_project
if !cli[:taxfile].nil?
cli.say 'Reading tax-file and registering taxonomy'
tfh = File.open(cli[:taxfile], '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.
Assignment Branch Condition size for perform is too high. [36.01/15] 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 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_start is too high. [35.41/15] Open
def test_start
p = project
d = daemon
d.runopts(:latency, 0, true)
assert_equal(0, d.latency)
- 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 remote_list is too high. [35.28/15] Open
def remote_list
cli.say 'Downloading genome list'
current_page = 1
total_pages = 1
ds = {}
- 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 merge_bidir_tmp is too high. [35.52/15] Open
def merge_bidir_tmp(tmp)
dist = { aai: {}, ani: {} }
cli[:threads].times do |i|
cli.advance('Merging:', i + 1, cli[:threads], false)
file = File.join(tmp, "#{i}.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
Method has too many lines. [30/10] Open
def configure_ssh_daemon(v)
v[:latency] = cli.ask_user('How long should I sleep? (in secs)', '3').to_i
v[:nodelist] = cli.ask_user(
'What environmental variable points to node list?', '$MIGA_NODELIST'
)
- 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 parse_cli is too high. [35.44/15] Open
def parse_cli
cli.expect_files = true
cli.defaults = { ref: true, ignore_dups: false }
cli.parse do |opt|
opt.separator 'You can create multiple datasets with a single command; ' \
- 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 get_sub_cli is too high. [35/15] Open
def get_sub_cli
return [cli] if cli[:file].nil? || cli[:ignore_file]
glob = []
cli_default = cli.original_argv + ['--ignore-file']
- 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 perform is too high. [35.92/15] Open
def perform
r = cli.load_result or return
cli[:compute] = false if cli[:try_load] && !r[:stats]&.empty?
- 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 dereplicate is too high. [35.74/15] Open
def dereplicate(p)
return if cli[:prepare_and_exit]
cli.say 'Extracting genomospecies clades'
r = p.result(:clade_finding) or raise 'Result unavailable: run failed'
- 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 opts_for_wf
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def opts_for_wf(opt, files_desc, params = {})
{
multi: false, cleanup: true, project_type: false, ncbi: true, qual: true
}.each { |k, v| params[k] = v if params[k].nil? }
opt.on(
- Create a ticketCreate a ticket
Method load_and_filter_datasets
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def load_and_filter_datasets(silent = false)
return @objects[:filtered_datasets] unless @objects[:filtered_datasets].nil?
say 'Listing datasets'
ds =
- 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
Block has too many lines. [68/25] Open
cli.parse do |opt|
opt.separator 'Available operations:'
{
start: 'Start an instance of the application',
stop: 'Start an instance of the application',
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Method has too many lines. [29/10] Open
def import_dataset(ds, method = :hardlink)
raise "Impossible to import dataset, it already exists: #{ds.name}." if
MiGA::Dataset.exist?(self, ds.name)
# Import dataset results
- 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. [29/10] Open
def configure_bash_daemon(v)
v[:latency] = cli.ask_user('How long should I sleep? (in secs)', '2').to_i
v[:maxjobs] = cli.ask_user('How many jobs can I launch at once?', '6').to_i
v[:ppn] = cli.ask_user('How many CPUs can I use per job?', '2').to_i
v[:nodelist] = nil # <- To enable non-default with default SSH
- 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.