False positive for Style/FormatStringToken in Rails validates format #7436
Labels
bug
library specific
This issue is related to a particular library, like Rails or RSpec, and not Ruby itself
In one of our Rails apps we've a validation that uses the "format" helper to constrain a value to a matching regex, it seems the Style/FormatStringToken cop has incorrectly matched this a use of the format method, which it is not.
Expected behavior
Given an
example.rb
file with the following content:and running the command
I expect to see no offenses.
Actual behavior
A single Style/FormatStringToken offense is reported
As an aside, the use of
%<colour>
in this context is not valid and would produce this error when attempting to save an invalid record:Steps to reproduce the problem
Covered above in expected behaviour
RuboCop version
The text was updated successfully, but these errors were encountered: