From 6a66dc1cfbe4e3a481e2a1e64f5678df3a013dcc Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Wed, 6 Dec 2023 13:19:09 +0100 Subject: [PATCH] DEV: Fix Lint/BooleanSymbol (#24747) --- app/controllers/extra_locales_controller.rb | 2 +- app/models/global_setting.rb | 2 ++ db/migrate/20140214151255_add_skipped_to_email_logs.rb | 2 +- db/migrate/20161207030057_add_public_to_groups.rb | 2 +- db/migrate/20210420015635_add_searchable_to_user_fields.rb | 2 +- lib/middleware/anonymous_cache.rb | 4 ++++ plugins/chat/spec/system/channel_message_upload_spec.rb | 2 +- plugins/discourse-narrative-bot/plugin.rb | 2 +- spec/services/flag_sockpuppets_spec.rb | 2 +- 9 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/controllers/extra_locales_controller.rb b/app/controllers/extra_locales_controller.rb index a6c04bee718..a9f075c367f 100644 --- a/app/controllers/extra_locales_controller.rb +++ b/app/controllers/extra_locales_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ExtraLocalesController < ApplicationController - layout :false + layout false skip_before_action :check_xhr, :preload_json, diff --git a/app/models/global_setting.rb b/app/models/global_setting.rb index ee4b042d229..6828beff916 100644 --- a/app/models/global_setting.rb +++ b/app/models/global_setting.rb @@ -89,6 +89,7 @@ class GlobalSetting @skip_redis end + # rubocop:disable Lint/BooleanSymbol def self.use_s3? ( @use_s3 ||= @@ -102,6 +103,7 @@ class GlobalSetting end ) == :true end + # rubocop:enable Lint/BooleanSymbol def self.s3_bucket_name @s3_bucket_name ||= s3_bucket.downcase.split("/")[0] diff --git a/db/migrate/20140214151255_add_skipped_to_email_logs.rb b/db/migrate/20140214151255_add_skipped_to_email_logs.rb index 19e111084d0..10c75d057c3 100644 --- a/db/migrate/20140214151255_add_skipped_to_email_logs.rb +++ b/db/migrate/20140214151255_add_skipped_to_email_logs.rb @@ -2,7 +2,7 @@ class AddSkippedToEmailLogs < ActiveRecord::Migration[4.2] def change - add_column :email_logs, :skipped, :boolean, default: :false + add_column :email_logs, :skipped, :boolean, default: false add_column :email_logs, :skipped_reason, :string add_index :email_logs, %i[skipped created_at] end diff --git a/db/migrate/20161207030057_add_public_to_groups.rb b/db/migrate/20161207030057_add_public_to_groups.rb index 7cdfbce71aa..4dc47c23dbb 100644 --- a/db/migrate/20161207030057_add_public_to_groups.rb +++ b/db/migrate/20161207030057_add_public_to_groups.rb @@ -2,6 +2,6 @@ class AddPublicToGroups < ActiveRecord::Migration[4.2] def change - add_column :groups, :public, :boolean, default: :false, null: false + add_column :groups, :public, :boolean, default: false, null: false end end diff --git a/db/migrate/20210420015635_add_searchable_to_user_fields.rb b/db/migrate/20210420015635_add_searchable_to_user_fields.rb index 7634f987e3e..3dc891f9815 100644 --- a/db/migrate/20210420015635_add_searchable_to_user_fields.rb +++ b/db/migrate/20210420015635_add_searchable_to_user_fields.rb @@ -2,6 +2,6 @@ class AddSearchableToUserFields < ActiveRecord::Migration[6.0] def change - add_column :user_fields, :searchable, :boolean, default: :false, null: false + add_column :user_fields, :searchable, :boolean, default: false, null: false end end diff --git a/lib/middleware/anonymous_cache.rb b/lib/middleware/anonymous_cache.rb index d41069c92e0..afb4238062d 100644 --- a/lib/middleware/anonymous_cache.rb +++ b/lib/middleware/anonymous_cache.rb @@ -85,6 +85,7 @@ module Middleware CrawlerDetection.is_blocked_crawler?(@env[USER_AGENT]) end + # rubocop:disable Lint/BooleanSymbol def is_mobile=(val) @is_mobile = val ? :true : :false end @@ -111,6 +112,7 @@ module Middleware end @has_brotli == :true end + # rubocop:enable Lint/BooleanSymbol def key_locale if locale = Discourse.anonymous_locale(@request) @@ -120,6 +122,7 @@ module Middleware end end + # rubocop:disable Lint/BooleanSymbol def is_crawler? @is_crawler ||= begin @@ -140,6 +143,7 @@ module Middleware @is_crawler == :true end alias_method :key_is_crawler?, :is_crawler? + # rubocop:enable Lint/BooleanSymbol def key_is_modern_mobile_device? MobileDetection.modern_mobile_device?(@env[USER_AGENT]) if @env[USER_AGENT] diff --git a/plugins/chat/spec/system/channel_message_upload_spec.rb b/plugins/chat/spec/system/channel_message_upload_spec.rb index c8e0e5e88d2..bae748e7868 100644 --- a/plugins/chat/spec/system/channel_message_upload_spec.rb +++ b/plugins/chat/spec/system/channel_message_upload_spec.rb @@ -28,7 +28,7 @@ RSpec.describe "Channel message selection", type: :system do chat.visit_channel(channel_1) find(".chat-message-collapser-button").click - expect(page).to have_css(".chat-message-collapser-body.hidden", visible: :false) + expect(page).to have_css(".chat-message-collapser-body.hidden", visible: false) find(".chat-message-collapser-button").click expect(page).to have_no_css(".chat-message-collapser-body.hidden") find(".chat-img-upload").click diff --git a/plugins/discourse-narrative-bot/plugin.rb b/plugins/discourse-narrative-bot/plugin.rb index 84d70249ab5..5f3b6ed1782 100644 --- a/plugins/discourse-narrative-bot/plugin.rb +++ b/plugins/discourse-narrative-bot/plugin.rb @@ -90,7 +90,7 @@ after_initialize do end class CertificatesController < ::ApplicationController - layout :false + layout false skip_before_action :check_xhr requires_login diff --git a/spec/services/flag_sockpuppets_spec.rb b/spec/services/flag_sockpuppets_spec.rb index 4f77d79b215..68810eaa31e 100644 --- a/spec/services/flag_sockpuppets_spec.rb +++ b/spec/services/flag_sockpuppets_spec.rb @@ -20,7 +20,7 @@ RSpec.describe SpamRule::FlagSockpuppets do before { SiteSetting.flag_sockpuppets = true } it "flags posts when it should" do - rule.expects(:reply_is_from_sockpuppet?).returns(:true) + rule.expects(:reply_is_from_sockpuppet?).returns(true) rule.expects(:flag_sockpuppet_users).once expect(perform).to eq(true) end