From b9bffeb3219d33c2a5dfbbb8463ed336900ba64c Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 16 Jun 2025 11:40:55 +0200 Subject: [PATCH] Add and apply Naming/PredicateMethod RuboCop 1.76 rule This rule was introduced in RuboCop 1.76.0 to ensure methods ending in '?' return boolean. This commit applies suggested renames and code cleanup: - Renames 'is_active?' to 'active_class' since it returns a string - Renames 'parsed_value' to 'in_favor?' and 'is_request_active' to end with '?' for boolean semantics - Skips false positives like 'save', 'auto_labels' or 'save_requiring_finish_signup', which are not predicate methods. --- .rubocop.yml | 8 ++++++++ app/components/sdg/goals/help_page_component.html.erb | 4 ++-- app/components/sdg/goals/help_page_component.rb | 2 +- app/components/shared/vote_button_component.rb | 4 ++-- app/helpers/proposals_dashboard_helper.rb | 2 +- app/views/dashboard/_menu.html.erb | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index dc61db8c8..828a5227d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -354,6 +354,14 @@ Naming/BlockForwarding: - "app/controllers/management/base_controller.rb" - "app/controllers/subscriptions_controller.rb" +Naming/PredicateMethod: + Enabled: true + Exclude: + - "app/models/local_census_records/import.rb" + - "app/models/user.rb" + - "app/models/verification/management/email.rb" + - "config/initializers/foundation_form_builder.rb" + Naming/RescuedExceptionsVariableName: Enabled: true diff --git a/app/components/sdg/goals/help_page_component.html.erb b/app/components/sdg/goals/help_page_component.html.erb index af052dd8b..0946cbdc3 100644 --- a/app/components/sdg/goals/help_page_component.html.erb +++ b/app/components/sdg/goals/help_page_component.html.erb @@ -9,7 +9,7 @@

<%= t("sdg.goals.help.description") %>