Showing 838 of 1,651 total issues
Method has too many lines. [26/10] 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 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. [26/10] 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)
- 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. [26/10] Open
def perform
cli.ensure_par(result: '-r')
ds = cli.load_and_filter_datasets
cli.say 'Loading results'
k = 0
- 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. [26/10] Open
def ncbi_asm_get(opts)
require 'tempfile'
require 'zip'
zipped = 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.
Assignment Branch Condition size for ncbi_asm_get is too high. [31.92/15] Open
def ncbi_asm_get(opts)
require 'tempfile'
require 'zip'
zipped = download(
- 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 perform
has a Cognitive Complexity of 24 (exceeds 5 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']
- 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 advance
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def advance(step, n = 0, total = nil, bin = true)
# Initialize advance timing
@_advance_time ||= { last: nil, n: 0, avg: nil, total: total }
if @_advance_time[:n] > n || total != @_advance_time[:total]
@_advance_time[:last] = 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 perform
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def perform
cli.ensure_par(result: '-r')
ds = cli.load_and_filter_datasets
cli.say 'Loading results'
k = 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
Assignment Branch Condition size for test_cds is too high. [30.27/15] Open
def test_cds
# Prepare result
dir = 'data/06.cds'
fa = file_path(dir, '.faa')
File.open(fa, 'w') { |fh| fh.puts('>1', 'M' * 500) }
- 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_daemon_launch is too high. [30.59/15] Open
def test_daemon_launch
lair = MiGA::Lair.new(tmpfile('sub'), latency: 1)
p = MiGA::Project.load(File.join(lair.path, 'project3'))
d = MiGA::Daemon.new(p)
assert_not_predicate(d, :active?)
- 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 save is too high. [30.68/15] Open
def save
return if self[:never_save]
return if !saved_hash.nil? && saved_hash == data.hash
MiGA::MiGA.DEBUG "Metadata.save #{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
Method has too many lines. [25/10] Open
def launch_job(job, hostk = nil)
# Execute job
job[:cmd] = job_cmd(job)
MiGA::MiGA.DEBUG "CMD: #{job[:cmd]}"
case runopts(: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.
Assignment Branch Condition size for parse is too high. [30.23/15] Open
def parse(path, opts = {})
opts = default_opts(opts)
# Read JSON
cont = 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
Cyclomatic complexity for run_cmd is too high. [21/6] 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]
- 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 tabulate is too high. [30.1/15] Open
def tabulate(header, values, tabular = false)
fields = []
fields << header.map(&:to_s) unless tabular && header.all?(&:nil?)
fields << fields.first.map { |h| h.gsub(/\S/, '-') } unless tabular
fields += values.map { |r| r.map { |cell| cell.nil? ? '?' : cell.to_s } }
- 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. [25/10] Open
def parse_cli
cli.defaults = {
query: false, unlink: false,
reference: false, add_version: true, dry: false,
get_md: false, only_md: false, save_every: 1
- 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.
Block has too many lines. [62/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. [25/10] Open
def configure_daemon
cli.puts 'Default daemon configuration:'
daemon_f = File.expand_path('.miga_daemon.json', ENV['MIGA_HOME'])
unless File.exist?(daemon_f) and cli.ask_user(
'A template daemon already exists, do you want to preserve it?',
- 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. [25/10] Open
def parse_cli
cli.defaults = {
query: false, unlink: false, reference: false,
complete: false, chromosome: false,
scaffold: false, contig: false, add_version: true, dry: false,
- 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. [25/10] Open
def parse_cli
cli.defaults = { try_load: false, thr: 1, env: false, check_first: false }
cli.parse do |opt|
cli.opt_object(opt, [:project, :dataset_opt, :result_opt])
opt.on(
- 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.