Add Rails/UniqueValidationWithoutIndex rule

This is something we should do everywhere because concurrent requests
might bypass Rails uniqueness validations. However, since there are
places where we aren't applying this rule and adding a unique index
means we also need to destroy any hypothetical duplicate records, it's
something we aren't going to solve right now. Therefore we use the
"refactor" severity so existing offenses don't get in our way.

In any case, we're adding the rule so we don't make the same mistake in
the future.
This commit is contained in:
Javi Martín
2020-10-11 20:40:13 +02:00
parent ae80fa4a1a
commit d7e6a5c6bf

View File

@@ -300,6 +300,10 @@ Rails/SkipsModelValidations:
Rails/TimeZone: Rails/TimeZone:
Enabled: true Enabled: true
Rails/UniqueValidationWithoutIndex:
Enabled: true
Severity: refactor
Rails/UnknownEnv: Rails/UnknownEnv:
Enabled: true Enabled: true
Environments: Environments: