Skip to content

Instantly share code, notes, and snippets.

@raivivek
Created October 6, 2014 15:01
Show Gist options
  • Save raivivek/7a52601b6619db46c1da to your computer and use it in GitHub Desktop.
Save raivivek/7a52601b6619db46c1da to your computer and use it in GitHub Desktop.
lib/ss/blast.rb - Rubocop warnings
Inspecting 1 file
C
Offenses:
lib/sequenceserver/blast.rb:114:5: C: Class definition is too long. [147/100]
class Report
^^^^^
lib/sequenceserver/blast.rb:116:7: C: Method has too many lines. [22/10]
def initialize(rfile)
^^^
lib/sequenceserver/blast.rb:150:22: C: Favor format over String#%.
s = '%.3f' % Regexp.last_match[1]
^
lib/sequenceserver/blast.rb:169:19: C: Favor format over String#%.
"#{'%.2f' % (hsp.identity * 100.0 / hsp.length)}"
^
lib/sequenceserver/blast.rb:173:19: C: Favor format over String#%.
"#{'%.2f' % (hsp.positives * 100.0 / hsp.length)}"
^
lib/sequenceserver/blast.rb:177:19: C: Favor format over String#%.
"#{'%.2f' % (hsp.gaps * 100.0 / hsp.length)}"
^
lib/sequenceserver/blast.rb:181:7: C: Cyclomatic complexity for pp_hsp is too high. [10/6]
def pp_hsp(hsp)
^^^
lib/sequenceserver/blast.rb:181:7: C: Method has too many lines. [40/10]
def pp_hsp(hsp)
^^^
lib/sequenceserver/blast.rb:181:7: C: Perceived complexity for pp_hsp is too high. [12/7]
def pp_hsp(hsp)
^^^
lib/sequenceserver/blast.rb:230:59: C: Favor format over String#%.
s << "Query %#{width}d #{lqseq} #{lqend}\n" % lqstart
^
lib/sequenceserver/blast.rb:239:59: C: Favor format over String#%.
s << "Subject %#{width}d #{lsseq} #{lsend}\n" % lsstart
^
lib/sequenceserver/blast.rb:247:7: C: Cyclomatic complexity for filter_hsp_stats is too high. [8/6]
def filter_hsp_stats(hsp)
^^^
lib/sequenceserver/blast.rb:247:7: C: Method has too many lines. [23/10]
def filter_hsp_stats(hsp)
^^^
lib/sequenceserver/blast.rb:247:7: C: Perceived complexity for filter_hsp_stats is too high. [9/7]
def filter_hsp_stats(hsp)
^^^
lib/sequenceserver/blast.rb:249:32: C: Favor format over String#%.
'Score' => "#{'%.2f' % hsp[:bit_score]}(#{hsp[:score]})",
^
lib/sequenceserver/blast.rb:257:9: C: Use 2 (not 4) spaces for indentation.
hsp_stats['Positives'] = "#{positives_fraction hsp}" \
^^^^
lib/sequenceserver/blast.rb:290:7: C: Method has too many lines. [11/10]
def node_to_value(node)
^^^
lib/sequenceserver/blast.rb:292:9: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
if node.is_a?(String)
^^
lib/sequenceserver/blast.rb:317:5: C: Cyclomatic complexity for blast is too high. [8/6]
def blast(params)
^^^
lib/sequenceserver/blast.rb:317:5: C: Method has too many lines. [37/10]
def blast(params)
^^^
lib/sequenceserver/blast.rb:341:7: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
if method == 'blastn' and not options =~ /task/
^^
lib/sequenceserver/blast.rb:341:29: C: Use && instead of and.
if method == 'blastn' and not options =~ /task/
^^^
lib/sequenceserver/blast.rb:341:33: C: Use ! instead of not.
if method == 'blastn' and not options =~ /task/
^^^
lib/sequenceserver/blast.rb:380:9: C: Use fail instead of raise to signal exceptions.
raise ArgumentError, error
^^^^^
lib/sequenceserver/blast.rb:385:9: C: Use fail instead of raise to signal exceptions.
raise RuntimeError.new(status, error)
^^^^^
lib/sequenceserver/blast.rb:397:5: C: Method has too many lines. [12/10]
def sequences_from_blastdb(sequence_ids, database_ids)
^^^
lib/sequenceserver/blast.rb:428:7: C: Use a guard clause instead of wrapping the code inside a conditional expression.
unless params[:sequence].nil?
^^^^^^
lib/sequenceserver/blast.rb:428:7: C: Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
unless params[:sequence].nil?
^^^^^^
lib/sequenceserver/blast.rb:446:7: C: Use fail instead of raise to signal exceptions.
raise ArgumentError, "BLAST algorithm should be one of:" \
^^^^^
lib/sequenceserver/blast.rb:446:28: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
raise ArgumentError, "BLAST algorithm should be one of:" \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/sequenceserver/blast.rb:451:45: C: Use && instead of and.
return true if sequences.is_a? String and not sequences.empty?
^^^
lib/sequenceserver/blast.rb:451:49: C: Use ! instead of not.
return true if sequences.is_a? String and not sequences.empty?
^^^
lib/sequenceserver/blast.rb:452:7: C: Use fail instead of raise to signal exceptions.
raise ArgumentError, 'Sequences should be a non-empty string.'
^^^^^
lib/sequenceserver/blast.rb:459:7: C: Use fail instead of raise to signal exceptions.
raise ArgumentError, "Database id should be one of:" \
^^^^^
lib/sequenceserver/blast.rb:459:28: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
raise ArgumentError, "Database id should be one of:" \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/sequenceserver/blast.rb:470:9: C: Use fail instead of raise to signal exceptions.
raise ArgumentError, 'Invalid characters detected in options.'
^^^^^
lib/sequenceserver/blast.rb:476:11: C: Use fail instead of raise to signal exceptions.
raise ArgumentError, "Option \"#{o}\" is prohibited."
^^^^^
1 file inspected, 37 offenses detected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment