Showing 838 of 1,651 total issues
Method initialize_by_ranks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize_by_ranks(str, ranks)
ranks = ranks.split(/\s+/) unless ranks.is_a? Array
str = str.split(/\s+/) unless str.is_a? Array
unless ranks.size == str.size
raise "Unequal number of ranks and names: #{ranks} => #{str}"
- 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 pull_hook
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pull_hook(event, *event_args)
event = event.to_sym
event_queue = (hooks[event] || [])
event_queue += (metadata[event] || []) if respond_to? :metadata
event_queue.each do |i|
- 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 add_alternative
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_alternative(tax, replace = true)
return if tax.nil?
raise 'Unsupported taxonomy class.' unless tax.is_a? MiGA::Taxonomy
alt_ns = alternative(tax.namespace)
- 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 fix_essential_genes_by_domain
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fix_essential_genes_by_domain
return if file_path(:raw_report)
tax = source.metadata[:tax]
return unless tax.nil? || %w[Archaea Bacteria].include?(tax[: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 sorted_ranks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sorted_ranks(force_ranks = false, with_namespace = false)
@@KNOWN_RANKS.map do |r|
next if
(r == :ns && !with_namespace) || (ranks[r].nil? && !force_ranks)
- 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 num_suffix
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def num_suffix(n, bin = false)
p = ''
{ T: 4, G: 3, M: 2, K: 1 }.each do |k, x|
v = (bin ? 1024 : 1e3)**x
if n > 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 <<
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def <<(value)
case value
when Hash
value.each do |r, n|
next if n.nil? || n == ''
- 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 add_result_assembly
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_result_assembly(base, opts)
return nil unless result_files_exist?(base, '.LargeContigs.fna')
r = add_files_to_ds_result(
MiGA::Result.new("#{base}.json"), name,
- 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 add_result_mytaxa
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_result_mytaxa(base, _opts)
if multi?
return nil unless
result_files_exist?(base, '.mytaxa') ||
result_files_exist?(base, '.nomytaxa.txt')
- 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 add_result_mytaxa_scan
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_result_mytaxa_scan(base, _opts)
if nonmulti?
return nil unless
result_files_exist?(base, %w[.pdf .mytaxa]) ||
result_files_exist?(base, '.nomytaxa.txt')
- 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 uri_safe_join
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def uri_safe_join(*parts)
safe = parts.map { |i| i.is_a?(Array) ? i.join(',') : i.to_s }
last = safe.pop
safe.map! { |i| i[-1] == '/' ? i : "#{i}/" }
safe << last
- 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 recalculate_status
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def recalculate_status(save = true)
old_status = metadata[:status]
metadata[:status] =
!active? ? 'inactive' : done_preprocessing? ? 'complete' : 'incomplete'
if save && (old_status.nil? || old_status != metadata[:status])
- 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 db_requested
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. 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
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 opt_common
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def opt_common(opt)
return unless @opt_common
if interactive
opt.on(
- 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 list_local
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def list_local
local_manif = local_manifest
raise "Local manifest not found." unless local_manif
databases =
if %i[recommended test].include?(cli[:database])
- 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 profile_advance
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def profile_advance(save = false)
# Determine the start point
first_task = first_preprocessing(save) or
return Array.new(self.class.PREPROCESSING_TASKS.size, 0)
- 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_get
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ncbi_asm_get(opts)
require 'tempfile'
require 'zip'
zipped = 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
Avoid more than 3 levels of block nesting. Open
left_time > 1440 ? ('%.1fd left' % (left_time / 1440)) :
left_time > 60 ? ('%.1fh left' % (left_time / 60)) :
('%.1fm left' % left_time)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for excessive nesting of conditional and looping constructs.
You can configure if blocks are considered using the CountBlocks
option. When set to false
(the default) blocks are not counted
towards the nesting level. Set to true
to count blocks as well.
The maximum level of nesting allowed is configurable.