Skip to content

Commit

Permalink
fix new rubocop offences
Browse files Browse the repository at this point in the history
  • Loading branch information
bmesuere committed Jul 1, 2015
1 parent 0d4d038 commit 4edf663
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Style/ClassAndModuleChildren:
Enabled: false

# disable for now
Lint/NestedMethodDefinition:
Enabled: false
Style/ClassVars:
Enabled: false
Style/Documentation:
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/unipept.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def create_root_command
option nil, :batch, 'specify the batch size', argument: :required, hidden: true
option nil, :parallel, 'specify the number of parallel requests', argument: :required, hidden: true
option :o, :output, 'write output to file', argument: :required
option :f, :format, "define the output format (available: #{Unipept::Formatter.available.join ', ' }) (default: #{Unipept::Formatter.default})", argument: :required
option :f, :format, "define the output format (available: #{Unipept::Formatter.available.join ', '}) (default: #{Unipept::Formatter.default})", argument: :required

# Configuration options
option nil, 'host', 'specify the server running the Unipept web service', argument: :required
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/unipept/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def run

if arguments.size == 2
set_config(key, value)
puts key + ' was set to ' + value
puts key + ' was set to ' + value
else
puts get_config(key)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/formatters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def footer
def convert(data, _first)
CSV.generate do |csv|
data.each do |o|
csv << o.values.map { |v| v == '' ? nil : v }
csv << o.values.map { |v| v == '' ? nil : v }
end
end
end
Expand All @@ -217,13 +217,13 @@ def to_xml(name = nil)

class ::Array
def to_xml(array_name = :array, _item_name = :item)
%(<#{array_name}>) + map { |n|n.to_xml(:item) }.join + "</#{array_name}>"
%(<#{array_name}>) + map { |n| n.to_xml(:item) }.join + "</#{array_name}>"
end
end

class ::Hash
def to_xml(name = nil)
data = to_a.map { |k, v|v.to_xml(k) }.join
data = to_a.map { |k, v| v.to_xml(k) }.join
name ? "<#{name}>#{data}</#{name}>" : data
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/commands/unipept/test_pept2prot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def test_run_with_fasta_multiple_batches
lines = out.each_line
assert_equal('', err)
assert(lines.next.start_with? 'fasta_header,peptide,uniprot_id,taxon_id')
assert(lines.select { |line| line.start_with? '>test,EGGAGSSTGQR,' }.size >= 1)
assert(lines.select { |line| line.start_with? '>test,ENFVYIAK,' }.size >= 1)
assert(lines.select { |line| line.start_with? '>tost,EGGAGSSTGQR,' }.size >= 1)
assert(lines.count { |line| line.start_with? '>test,EGGAGSSTGQR,' } >= 1)
assert(lines.count { |line| line.start_with? '>test,ENFVYIAK,' } >= 1)
assert(lines.count { |line| line.start_with? '>tost,EGGAGSSTGQR,' } >= 1)
end

def test_run_with_fasta_multiple_batches_json
Expand Down
6 changes: 3 additions & 3 deletions test/commands/unipept/test_pept2taxa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def test_run_with_fasta_multiple_batches
lines = out.each_line
assert_equal('', err)
assert(lines.next.start_with? 'fasta_header,peptide,taxon_id,taxon_name,taxon_rank')
assert(lines.select { |line| line.start_with? '>test,EGGAGSSTGQR,' }.size >= 1)
assert(lines.select { |line| line.start_with? '>test,ENFVYIAK,' }.size >= 1)
assert(lines.select { |line| line.start_with? '>tost,EGGAGSSTGQR,' }.size >= 1)
assert(lines.count { |line| line.start_with? '>test,EGGAGSSTGQR,' } >= 1)
assert(lines.count { |line| line.start_with? '>test,ENFVYIAK,' } >= 1)
assert(lines.count { |line| line.start_with? '>tost,EGGAGSSTGQR,' } >= 1)
end

def test_run_with_fasta_multiple_batches_json
Expand Down
6 changes: 3 additions & 3 deletions test/commands/unipept/test_taxonomy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def test_run_with_fasta_multiple_batches
lines = out.each_line
assert_equal('', err)
assert(lines.next.start_with? 'fasta_header,taxon_id,taxon_name,taxon_rank')
assert(lines.select { |line| line.start_with? '>test,1,' }.size >= 1)
assert(lines.select { |line| line.start_with? '>test,216816,' }.size >= 1)
assert(lines.select { |line| line.start_with? '>tost,1,' }.size >= 1)
assert(lines.count { |line| line.start_with? '>test,1,' } >= 1)
assert(lines.count { |line| line.start_with? '>test,216816,' } >= 1)
assert(lines.count { |line| line.start_with? '>tost,1,' } >= 1)
end

def test_run_with_fasta_multiple_batches_json
Expand Down
4 changes: 2 additions & 2 deletions test/test_retryable_typhoeus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def test_failing_requests_finally_complete_with_error

def new_request(extra_opts = {})
::RetryableTyphoeus::Request.new(
'stubbed.com',
request_options.merge(extra_opts)
'stubbed.com',
request_options.merge(extra_opts)
)
end

Expand Down

0 comments on commit 4edf663

Please sign in to comment.