Skip to content

Commit

Permalink
add workaround for rubocop > 0.51.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eitoball committed Apr 12, 2018
1 parent 1e631b5 commit f52ec56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spec/rubocop/formatter/checkstyle_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ module Formatter
source_buffer = Parser::Source::Buffer.new('sample.rb', 1).tap { |b| b.source = '' }
severities.each_with_index do |severity, index|
if c.respond_to?(:add_offense)
c.add_offense(nil, Parser::Source::Range.new(source_buffer, 0, index), severity.to_s, severity)
type = c.method(:add_offense).parameters.last.first
if %i(block key).include?(type)
c.add_offense(nil, location: Parser::Source::Range.new(source_buffer, 0, index), message: severity.to_s)
else
c.add_offense(nil, Parser::Source::Range.new(source_buffer, 0, index), severity.to_s, severity)
end
else
begin
c.add_offence(severity, nil, Parser::Source::Range.new(source_buffer, 0, index), severity.to_s)
Expand Down

0 comments on commit f52ec56

Please sign in to comment.