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
Let me clarify what the problem is. MaxSlashes is the maximum number of (escaped) slashes that a slash-delimited regexp is allowed to have. If there are more slashes, it should be a %r regexp. This also means that %r literals must have more slashes than MaxSlashes.
So for sample.rb above, --auto-gen-config should generate
RegexpLiteral:
MaxSlashes: 0
For code containing %r{abc} and %r{abc/123} it should generate MaxSlashes: -1, meaning that only %r literals should be used.
For code containing %r{abc} and /abc/ it should generate Enabled: false, because there's no MaxSlashes setting that would allow both of them.
To reproduce, create the file
sample.rb
included below. Runrubocop --auto-gen-config
.rubocop --config rubocop-todo.yml
gives the following warning:The generated
rubocop-todo.yml
includes:# Offence count: 1 RegexpLiteral: MaxSlashes: 2
It should be
MaxSlashes: 1
to avoid the warning.The text was updated successfully, but these errors were encountered: