File cmdline.rb
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Transrate
class Cmdline
require 'trollop'
Class Cmdline
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Cmdline
require 'trollop'
require 'csv'
require 'bindeps'
Method write_contig_csv
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def write_contig_csv a
# write contig metrics to file for each contig
outfile = File.expand_path "contigs.csv"
logger.info "Writing contig metrics for each contig to #{outfile}"
# have option to turn off, default on
- Read upRead up
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 argument_parser
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def argument_parser
cmdline = self
Trollop::Parser.new do
version Transrate::VERSION::STRING.dup
banner cmdline.help_message
Method check_reads
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_reads
if @opts.left and @opts.right
if @opts.left.split(",").length != @opts.right.split(",").length
msg = "Please provide the same number of left reads as right reads"
raise TransrateArgError.new msg
- Read upRead up
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 print_missing_dependencies
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print_missing_dependencies(missing, blast_missing)
if missing.length + blast_missing.length > 0
puts "Dependencies are missing:"
missing.each do |dep|
Method analyse_assembly
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def analyse_assembly(assembly, r, result_path)
logger.info "Loading assembly: #{assembly}"
a = Assembly.new assembly
logger.info "Analysing assembly: #{assembly}"
Method check_dependencies
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_dependencies
# Check dependencies if they are relevant to the command issued,
# and handle any commands to install missing ones
gem_dir = Gem.loaded_specs['transrate'].full_gem_path
gem_deps = File.join(gem_dir, 'deps', 'deps.yaml')
- Read upRead up
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 install_missing_dependencies
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def install_missing_dependencies(deps, read_deps, ref_deps,
gem_deps, blast_dep)
Method check_assembly
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_assembly
if @opts.assembly
@opts[:assembly] = @opts.assembly.split(',').map do |a|
File.expand_path a
end.join(',')
- Read upRead up
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"