From b09f41136fbc363f28bc404eb6873401d0f425d5 Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Sat, 22 Jun 2024 07:39:36 +0200 Subject: [PATCH] Fixes Rails/UnknownEnv offense - Cop: Rails/UnknownEnv - Cf. https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsunknownenv - Rails.env.typo? will always return false and will not return an error - The way to check this is to add environments in the Environments config parameter - in the rubocop file. --- .rubocop_styleguide.yml | 7 +++++++ .rubocop_todo.yml | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.rubocop_styleguide.yml b/.rubocop_styleguide.yml index f2c8f29bb2..29bdef8e08 100644 --- a/.rubocop_styleguide.yml +++ b/.rubocop_styleguide.yml @@ -129,6 +129,13 @@ Rails/SkipsModelValidations: - update_column - update_columns +Rails/UnknownEnv: + Environments: + - development + - production + - staging + - test + Rails/WhereExists: EnforcedStyle: where # Cf. conversion https://github.com/openfoodfoundation/openfoodnetwork/pull/12363 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 70022fface..e054d5ae51 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -693,13 +693,6 @@ Rails/UniqueValidationWithoutIndex: - 'app/models/spree/tax_category.rb' - 'app/models/spree/zone.rb' -# Offense count: 1 -# Configuration parameters: Severity, Environments. -# Environments: development, test, production -Rails/UnknownEnv: - Exclude: - - 'app/models/spree/app_configuration.rb' - # Offense count: 1 Security/Open: Exclude: