You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ bundle exec rubocop foo.rb -a
Inspecting 1 file
E
Offenses:
foo.rb:4:6: C: [Corrected] Performance/RegexpMatch: Use match? instead of =~ when MatchData is not used.
if id.=~(/\./)
^^^^^^^^^^^
foo.rb:7:21: E: Lint/Syntax: unexpected token tRPAREN
(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops)
if /\./.match?(id))
^
foo.rb:9:3: W: Lint/Syntax: else without rescue is useless
(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops)
else
^^^^
foo.rb:12:1: E: Lint/Syntax: unexpected token kEND
(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops)
end
^^^
RuboCop version
Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:
I'm getting a syntax error auto-correcting a
Performance/RegexpMatch
violation in the following method definition:Expected behavior
I expect this to autocorrect to:
Actual behavior
The autocorrection has an extra
)
, leading to a syntax error:Steps to reproduce the problem
Put the above snippet into a
foo.rb
file, then:RuboCop version
Include the output of
rubocop -V
orbundle exec rubocop -V
if using Bundler. Here's an example:(
rubocop-performance
version is1.3.0
)The text was updated successfully, but these errors were encountered: