Showing 1,637 of 1,651 total issues
Method has too many lines. [13/10] Open
def generate_project_page(p)
# Redirect page
write_file(p, '../index.html') { build_from_template('redirect.html') }
# Summaries
- 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.
Perceived complexity for get_files_and_type is too high. [10/7] Open
def get_files_and_type
files = cli.files
file_type = nil
if files.empty?
cli.ensure_par({ dataset: '-D' },
- 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. [13/10] Open
def perform
p = cli.load_project
ud = p.unregistered_datasets
ud.each do |dn|
cli.puts dn
- 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.
Perceived complexity for download_datasets is too high. [10/7] Open
def download_datasets
# Download datasets from NCBI
unless cli[:ncbi_taxon].nil?
what = cli[:ncbi_ref] ? '--reference' :
cli[:ncbi_draft] ? '--all' : '--complete'
- 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
Perceived complexity for perform is too high. [10/7] Open
def perform
ds = cli.load_and_filter_datasets(cli[:silent])
p = cli.load_project
exit(ds.empty? ? 1 : 0) if cli[:silent]
- 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
Perceived complexity for perform is too high. [10/7] Open
def perform
unless cli[:value].nil?
cli.ensure_par(
{ key: '-k' },
'%<name>s is mandatory when --value is set: provide %<flag>s'
- 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. [13/10] Open
def format_table(ds, header, &blk)
io = cli[:output].nil? ? $stdout : File.open(cli[:output], 'w')
cli.say 'Collecting metadata'
k = 0
cli.table(
- 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. [13/10] Open
def perform
glob = get_sub_cli
p = cli.load_project
load_ncbi_taxonomy_dump
glob.each do |sub_cli|
- 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 db_requested is too high. [18.36/15] Open
def db_requested(manif)
[:recommended, :test].each do |n|
if cli[:database] == n
raise "This host has no #{n} database" if manif[n].nil?
- 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 find_software is too high. [18.87/15] 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
- 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. [18.79/15] Open
def perform
if cli[:result] && r = cli.load_result
cli[:remove] ? r.remove! : r.unlink
elsif d = cli.load_dataset
cli.load_project.unlink_dataset(d.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
Method seqs_length
has 50 lines of code (exceeds 25 allowed). Consider refactoring. 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
- Create a ticketCreate a ticket
Method test_add_result_other
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_add_result_other
d2 = project.add_dataset('ds_add_result_other')
Dir.mkdir(
File.join(
project.path, 'data', '07.annotation', '01.function', '01.essential',
- Create a ticketCreate a ticket
Method perform
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
# Load environment variables if requested (typically by the daemon)
if cli[:env]
cli[:project] ||= ENV['PROJECT']
cli[:dataset] ||= ENV['DATASET']
- Create a ticketCreate a ticket
Method parse_cli
has 48 lines of code (exceeds 25 allowed). Consider refactoring. 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; ' \
- Create a ticketCreate a ticket
Method download_file_ftp
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def download_file_ftp(connection, file = nil, target = nil)
# Open connection unless passed
close_conn = false
if connection.is_a?(String) || connection.is_a?(Symbol) ||
connection.is_a?(URI)
- 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 save_bidirectional
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def save_bidirectional(a, dist)
each_database_file(a) do |db_file, metric, result, rank|
next if rank == :haai # No need for hAAI to be bidirectional
next if result == :taxonomy # Taxonomy is never bidirectional
- 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 get_files_and_type
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_files_and_type
files = cli.files
file_type = nil
if files.empty?
cli.ensure_par({ dataset: '-D' },
- 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 remote_list
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def remote_list
cli.say 'Downloading genome list'
current_page = 1
total_pages = 1
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
Method next_task
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def next_task(tasks = nil, save = false)
tasks ||= result_dirs.keys
tasks.find do |t|
if ignore_task?(t)
# Do not run if this step is to be ignored
- 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"