From d7e6a5c6bf73f1a5db30bfa979b7db57e34ae707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 11 Oct 2020 20:40:13 +0200 Subject: [PATCH] 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. --- .rubocop.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index dda05fc8a..8f9cbdaa0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -300,6 +300,10 @@ Rails/SkipsModelValidations: Rails/TimeZone: Enabled: true +Rails/UniqueValidationWithoutIndex: + Enabled: true + Severity: refactor + Rails/UnknownEnv: Enabled: true Environments: