DEV: Fix Lint/BooleanSymbol (#24747)

This commit is contained in:
Jarek Radosz 2023-12-06 13:19:09 +01:00 committed by GitHub
parent 138bf486d3
commit 6a66dc1cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 7 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class ExtraLocalesController < ApplicationController
layout :false
layout false
skip_before_action :check_xhr,
:preload_json,

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -90,7 +90,7 @@ after_initialize do
end
class CertificatesController < ::ApplicationController
layout :false
layout false
skip_before_action :check_xhr
requires_login

View File

@ -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