Showing 179 of 1,602 total issues
Method find_software
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find_software(exec)
path = nil
loop do
d_path = File.dirname(run_cmd(cli, ['which', exec], raise: false))
if cli[:ask] || d_path == '.'
- 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 ncbi_asm_acc2id
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
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
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 compute_stats_cds
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def compute_stats_cds
s = MiGA::MiGA.seqs_length(file_path(:proteins), :fasta)
stats = {
predicted_proteins: s[:n],
average_length: [s[:avg], 'aa']
- 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 clean_fasta_file
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def clean_fasta_file(file)
tmp_fh = nil
tmp_path = nil
begin
if file =~ /\.gz/
- 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 declare_alive_loop
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def declare_alive_loop(pid = Process.ppid)
i = -1
loop do
i += 1
return :no_home unless Dir.exist? daemon_home
- 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 check_cds
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_cds(cli)
cli.say 'Looking for unzipped genes or proteins'
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
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 ncbi_asm_json_doc
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ncbi_asm_json_doc
return @_ncbi_asm_json_doc unless @_ncbi_asm_json_doc.nil?
if db == :assembly && %i[ncbi gtdb seqcode].include?(universe)
metadata[:ncbi_asm] ||= ids.first
- Create a ticketCreate a ticket
Method test_preprocessing
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_preprocessing
p1 = project
assert_predicate(p1, :done_preprocessing?)
d1 = p1.add_dataset('BAH')
assert_not_predicate(p1, :done_preprocessing?)
- Create a ticketCreate a ticket
Method check_db
has 27 lines of code (exceeds 25 allowed). Consider refactoring. 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|
- Create a ticketCreate a ticket
Method use_ncbi_taxonomy_dump
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def use_ncbi_taxonomy_dump(path, cli = nil)
raise "Directory doesn't exist: #{path}" unless File.directory?(path)
# Structure: { TaxID => ["name", "rank", parent TaxID] }
MiGA::MiGA.DEBUG "Loading NCBI Taxonomy dump: #{path}"
- Create a ticketCreate a ticket
Method perform
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
unless cli[:value].nil?
cli.ensure_par(
{ key: '-k' },
'%<name>s is mandatory when --value is set: provide %<flag>s'
- Create a ticketCreate a ticket
Method get_files_and_type
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_files_and_type
files = cli.files
file_type = nil
if files.empty?
cli.ensure_par({ dataset: '-D' },
- Create a ticketCreate a ticket
Method add_metadata
has 26 lines of code (exceeds 25 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('=')
- Create a ticketCreate a ticket
Method test_check_datasets
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_check_datasets
p = project
d = daemon
d.runopts(:maxjobs, 0, true)
assert_empty(d.jobs_to_run)
- Create a ticketCreate a ticket
Method parse
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(path, opts = {})
opts = default_opts(opts)
# Read JSON
cont = path
- Create a ticketCreate a ticket
Method perform
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
cli.ensure_par(result: '-r')
ds = cli.load_and_filter_datasets
cli.say 'Loading results'
k = 0
- Create a ticketCreate a ticket
Method ncbi_asm_get
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ncbi_asm_get(opts)
require 'tempfile'
require 'zip'
zipped = download(
- Create a ticketCreate a ticket
Method parse_cli
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_cli
cli.defaults = { units: false, tabular: false }
cli.parse do |opt|
cli.opt_object(opt, [:project, :dataset_opt])
cli.opt_filter_datasets(opt)
- Create a ticketCreate a ticket
Method save_entry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def save_entry(name, body, p)
cli.say " Locating remote dataset: #{name}"
body[:md][:metadata_only] = true if cli[:only_md]
rd = MiGA::RemoteDataset.new(body[:ids], body[:db], body[:universe])
if cli[:get_md]
- 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 format_result_stats
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def format_result_stats(res)
res.stats.map do |k, v|
v = [v, ''] unless v.is_a? Array
v[0] = ('%.3g' % v[0]) if v[0].is_a? Float
"<b>#{format_name(k)}:</b> #{v[0]}#{v[1]}<br/>"
- 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"