Showing 1,637 of 1,651 total issues
Cyclomatic complexity for create_remote_dataset is too high. [7/6] Open
def create_remote_dataset(sub_cli, p)
sub_cli.ensure_par(dataset: '-D', ids: '-I')
unless sub_cli[:api_key].nil?
if sub_cli[:universe] == :web && sub_cli[:db] == :assembly_gz
ENV['NCBI_API_KEY'] = sub_cli[:api_key]
- 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.
Assignment Branch Condition size for list_databases is too high. [16.03/15] Open
def list_databases(manif)
return false unless cli[:list_databases]
cli.puts "# Recommended database: #{manif[:recommended]}"
cli.puts ''
- 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. [11/10] Open
def download_opts(
universe, db, ids, format, file = nil, extra = {}, obj = nil)
universe_hash = @@UNIVERSE[universe]
database_hash = universe_hash.dig(:dbs, db)
getter = database_hash[:getter] || :download
- 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. [11/10] Open
def closest_relatives(how_many = 1, ref_project = false, metric = :aai)
return nil if multi?
r = result(ref_project ? :taxonomy : :distances)
return nil if r.nil?
- 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 opt_common is too high. [16.55/15] Open
def opt_common(opt)
return unless @opt_common
if interactive
opt.on(
- 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. [11/10] Open
def add_result_essential_genes(base, _opts)
return nil unless result_files_exist?(base, %w[.ess.faa .ess .ess/log])
add_files_to_ds_result(
MiGA::Result.new("#{base}.json"), name,
- 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 ignore_by_type? is too high. [7/6] Open
def ignore_by_type?(task, type)
return false if force_task?(task)
test, list =
case type.to_sym
- 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. [11/10] Open
def download(*params)
opts = download_opts(*params)
doc = send(opts[:_fun], opts)
unless opts[:file].nil?
- 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. [11/10] Open
def add_result_trimmed_fasta(base, _opts)
return nil unless
result_files_exist?(base, '.CoupledReads.fa') ||
result_files_exist?(base, '.SingleReads.fa') ||
result_files_exist?(base, %w[.1.fasta .2.fasta])
- 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. [11/10] Open
def check_type
raise MiGA::Error.new('Undefined dataset type') unless type
return false if type == :empty
unless self.class.KNOWN_TYPES[type]
- 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 run_cmd
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_cmd(cmd, opts = {})
opts = run_cmd_opts(opts)
cmd = cmd.shelljoin if cmd.is_a?(Array)
spawn_opts = {}
spawn_opts[:out] = opts[:stdout] if opts[:stdout]
- Create a ticketCreate a ticket
Method parse_cli
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_cli
cli.defaults = { info: false, processing: false, silent: false }
cli.parse do |opt|
cli.opt_object(opt, [:project, :dataset_opt])
cli.opt_filter_datasets(opt)
- Create a ticketCreate a ticket
Method clean_fasta_file
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def clean_fasta_file(file, min_len = 1)
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 perform
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def perform
p = cli.load_project
if not cli[:datum].nil?
v = p.metadata[cli[:datum]]
cli.puts v.nil? ? '?' : v
- 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 perform
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. 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
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 each_project
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def each_project(dir = path)
Dir.entries(dir).each do |f|
next if %w[. ..].include?(f) # Ruby <= 2.3 doesn't have Dir.children
f = File.join(dir, f)
- 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 unregistered_datasets
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def unregistered_datasets
datasets = []
MiGA::Dataset.RESULT_DIRS.values.each do |dir|
dir_p = "#{path}/data/#{dir}"
next unless Dir.exist? dir_p
- 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_dist_eval
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def check_dist_eval(cli, p, res)
y = { notok: Set.new, fix: Set.new }
Zlib::GzipReader.open(res.file_path(:matrix)) do |fh|
lineno = 0
fh.each_line do |ln|
- 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 reference_db
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def reference_db
cli.say "Locating reference database"
ref_db_path = cli[:db_path]
if ref_db_path.nil?
if cli[:download]
- 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 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def clean_fasta_file(file, min_len = 1)
tmp_fh = nil
tmp_path = nil
begin
if file =~ /\.gz/
- Create a ticketCreate a ticket