Showing 80 of 80 total issues
Method bin
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def self.bin(bins, objects, *data_capture_obj, &block)
data_capture = data_capture_obj.first || bins
if objects.size > 0
obj_e = objects.each ; obj = obj_e.next
- 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 create_digestion_file
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def create_digestion_file(fasta_file, opts={})
opts = DEFAULT_PEPTIDE_CENTRIC_DB.merge(opts)
(missed_cleavages, enzyme, cleave_initiator_methionine, expand_aa) = opts.values_at(:missed_cleavages, :enzyme, :cleave_initiator_methionine, :expand_aa)
start_time = Time.now
- 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 write
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write(mzml_filenames, config={})
base = config[:combine] || mzml_filenames.first.chomp(File.extname(mzml_filenames.first))
config[:imzml_filename] = base + ".imzML"
config[:ibd_filename] = base + ".ibd"
Method merge_centroids
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def merge_centroids(peaklists, opts={})
opts[:return_data] = true if opts[:only_data]
# Create Mspire::Bin objects
bins = opts[:bins] ? opts[:bins] : create_bins(peaklists, opts)
- 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 write
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def write(mzml_filenames, config={})
base = config[:combine] || mzml_filenames.first.chomp(File.extname(mzml_filenames.first))
config[:imzml_filename] = base + ".imzML"
config[:ibd_filename] = base + ".ibd"
- 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
File writer.rb
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
require 'securerandom'
require 'cv'
require 'mspire/mzml'
require 'mspire/mzml/spectrum'
Method hash_like_from_digestion_file
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def hash_like_from_digestion_file(digestion_file, min_length, data_type=:hash)
case data_type
when :trie
trie = get_a_trie
::IO.foreach(digestion_file) do |line|
- 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 from_xml
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.from_xml(xml, link)
da = self.new
binary_n = da.describe_from_xml!(xml, link[:ref_hash])
if (dp_id = xml[:dataProcessingRef])
- 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 read_header!
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_header!(list_type_to_default_data_processing_id)
@io.rewind
string = get_header_string(@io)
doc = Nokogiri::XML.parse(string, nil, @encoding, Mspire::Mzml::Parser::NOBLANKS)
Method to_xml
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(filename=nil)
# TODO: support indexed mzml files
io = filename ? File.open(filename, 'w') : StringIO.new
xml = Builder::XmlMarkup.new(:target => io, :indent => 2)
xml.instruct!
- 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 parser
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parser
return @parser if @parser
default_config = "config.yaml"
scan_patterns = %w(flyback meandering random)
Method run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def run(normalize=true, opts={})
exe = executable
puts "using #{exe}" if $VERBOSE
executable_base = exe.split('-')[0]
- 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 hash_like_from_digestion_file
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hash_like_from_digestion_file(digestion_file, min_length, data_type=:hash)
case data_type
when :trie
trie = get_a_trie
::IO.foreach(digestion_file) do |line|
Method to_binary
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def to_binary
# single pass over params for speed
pack_code = nil
compression = nil
each_accessionable_param do |param|
- 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 x_y_positions
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def x_y_positions(config)
(scan_pattern, scan_type, scan_direction, scan_sequence, shots_per_pos) = config.values_at(:scan_pattern, :scan_type, :linescan_direction, :linescan_sequence, :shots_per_position).map(&:to_s)
shots_per_pos = shots_per_pos.to_i
#puts "EXAMIN ARGS: "
#p [ scan_pattern, scan_type, scan_direction, scan_sequence, shots_per_pos, shots_per_pos]
- 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 to_xml
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(builder=nil)
xmlb = builder || Nokogiri::XML::Builder.new
hash = {:base_name => base_name, :msManufacturer => ms_manufacturer, :msModel => ms_model, :msIonization => ms_ionization, :msMassAnalyzer => ms_mass_analyzer, :msDetector => ms_detector, :raw_data_type => raw_data_type, :raw_data => raw_data}
hash.each {|k,v| hash.delete(k) unless v }
xmlb.msms_run_summary(hash) do |xmlb|
- 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 image_hash_to_cvs
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def image_hash_to_cvs(hash)
cvs = []
cvs << case hash[:data_structure].to_sym
when :processed ; 'IMS:1000031'
when :continuous ; 'IMS:1000030'
Method merge_centroids
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def merge_centroids(peaklists, opts={})
opts[:return_data] = true if opts[:only_data]
# Create Mspire::Bin objects
bins = opts[:bins] ? opts[:bins] : create_bins(peaklists, opts)
Method create_digestion_file
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_digestion_file(fasta_file, opts={})
opts = DEFAULT_PEPTIDE_CENTRIC_DB.merge(opts)
(missed_cleavages, enzyme, cleave_initiator_methionine, expand_aa) = opts.values_at(:missed_cleavages, :enzyme, :cleave_initiator_methionine, :expand_aa)
start_time = Time.now
Method peptide_hits_to_protein_groups
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.peptide_hits_to_protein_groups(peptide_hits, update_peptide_hits=false, &sort_by)
update_peptide_hits = 'protein_groups='.to_sym if (update_peptide_hits==true)
sort_by ||= PRIORITIZE_PROTEINS
# note to self: I wrote this in 2011, so I think I know what I'm doing now
protein_to_peptides = Hash.new {|h,k| h[k] = Set.new }