Merge pull request #16341 from issyl0/rubocop-ruby-3.1
rubocop: Set TargetRubyVersion to 3.1 & disable all cops that fail
This commit is contained in:
commit
dc3daf77a5
@ -12,7 +12,7 @@ inherit_mode:
|
|||||||
- Exclude
|
- Exclude
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
TargetRubyVersion: 2.6
|
TargetRubyVersion: 3.1
|
||||||
ActiveSupportExtensionsEnabled: true
|
ActiveSupportExtensionsEnabled: true
|
||||||
NewCops: enable
|
NewCops: enable
|
||||||
Include:
|
Include:
|
||||||
@ -386,9 +386,10 @@ Style/InvertibleUnlessCondition:
|
|||||||
# Don't require non-standard `exclude?` (for now at least) - it's not available in every file
|
# Don't require non-standard `exclude?` (for now at least) - it's not available in every file
|
||||||
# :include?:
|
# :include?:
|
||||||
|
|
||||||
# would rather freeze too much than too little
|
# TODO: Enable this cop again once https://github.com/Homebrew/brew/pull/16337#issuecomment-1855668516 is done.
|
||||||
|
# From the RuboCop docs: "NOTE: Regexp and Range literals are frozen objects since Ruby 3.0."
|
||||||
Style/MutableConstant:
|
Style/MutableConstant:
|
||||||
EnforcedStyle: strict
|
Enabled: false
|
||||||
|
|
||||||
# Zero-prefixed octal literals are widely used and understood.
|
# Zero-prefixed octal literals are widely used and understood.
|
||||||
Style/NumericLiteralPrefix:
|
Style/NumericLiteralPrefix:
|
||||||
@ -469,3 +470,21 @@ Style/UnlessLogicalOperators:
|
|||||||
# a bit confusing to non-Rubyists but useful for longer arrays
|
# a bit confusing to non-Rubyists but useful for longer arrays
|
||||||
Style/WordArray:
|
Style/WordArray:
|
||||||
MinSize: 4
|
MinSize: 4
|
||||||
|
|
||||||
|
# TODO: Enable these cops once https://github.com/Homebrew/brew/pull/16337#issuecomment-1855668516 is done.
|
||||||
|
Lint/RedundantDirGlobSort:
|
||||||
|
Enabled: false
|
||||||
|
Naming/BlockForwarding:
|
||||||
|
Enabled: false
|
||||||
|
Performance/BindCall:
|
||||||
|
Enabled: false
|
||||||
|
Performance/MapCompact:
|
||||||
|
Enabled: false
|
||||||
|
Style/ArgumentsForwarding:
|
||||||
|
Enabled: false
|
||||||
|
Style/ArrayIntersect:
|
||||||
|
Enabled: false
|
||||||
|
Style/HashSyntax:
|
||||||
|
EnforcedShorthandSyntax: either
|
||||||
|
Style/RedundantFreeze:
|
||||||
|
Enabled: false
|
||||||
|
@ -10,13 +10,10 @@ class PATH
|
|||||||
|
|
||||||
delegate each: :@paths
|
delegate each: :@paths
|
||||||
|
|
||||||
# FIXME: Enable cop again when https://github.com/sorbet/sorbet/issues/3532 is fixed.
|
|
||||||
# rubocop:disable Style/MutableConstant
|
|
||||||
Element = T.type_alias { T.nilable(T.any(Pathname, String, PATH)) }
|
Element = T.type_alias { T.nilable(T.any(Pathname, String, PATH)) }
|
||||||
private_constant :Element
|
private_constant :Element
|
||||||
Elements = T.type_alias { T.any(Element, T::Array[Element]) }
|
Elements = T.type_alias { T.any(Element, T::Array[Element]) }
|
||||||
private_constant :Elements
|
private_constant :Elements
|
||||||
# rubocop:enable Style/MutableConstant
|
|
||||||
|
|
||||||
sig { params(paths: Elements).void }
|
sig { params(paths: Elements).void }
|
||||||
def initialize(*paths)
|
def initialize(*paths)
|
||||||
|
@ -8,10 +8,7 @@ module Cask
|
|||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
module Staged
|
module Staged
|
||||||
# FIXME: Enable cop again when https://github.com/sorbet/sorbet/issues/3532 is fixed.
|
|
||||||
# rubocop:disable Style/MutableConstant
|
|
||||||
Paths = T.type_alias { T.any(String, Pathname, T::Array[T.any(String, Pathname)]) }
|
Paths = T.type_alias { T.any(String, Pathname, T::Array[T.any(String, Pathname)]) }
|
||||||
# rubocop:enable Style/MutableConstant
|
|
||||||
|
|
||||||
sig { params(paths: Paths, permissions_str: String).void }
|
sig { params(paths: Paths, permissions_str: String).void }
|
||||||
def set_permissions(paths, permissions_str)
|
def set_permissions(paths, permissions_str)
|
||||||
|
@ -133,12 +133,9 @@ end
|
|||||||
|
|
||||||
class String
|
class String
|
||||||
BLANK_RE = /\A[[:space:]]*\z/.freeze
|
BLANK_RE = /\A[[:space:]]*\z/.freeze
|
||||||
# This is a cache that is intentionally mutable
|
|
||||||
# rubocop:disable Style/MutableConstant
|
|
||||||
ENCODED_BLANKS_ = T.let(Hash.new do |h, enc|
|
ENCODED_BLANKS_ = T.let(Hash.new do |h, enc|
|
||||||
h[enc] = Regexp.new(BLANK_RE.source.encode(enc), BLANK_RE.options | Regexp::FIXEDENCODING)
|
h[enc] = Regexp.new(BLANK_RE.source.encode(enc), BLANK_RE.options | Regexp::FIXEDENCODING)
|
||||||
end, T::Hash[Encoding, Regexp])
|
end, T::Hash[Encoding, Regexp])
|
||||||
# rubocop:enable Style/MutableConstant
|
|
||||||
|
|
||||||
# A string is blank if it's empty or contains whitespaces only:
|
# A string is blank if it's empty or contains whitespaces only:
|
||||||
#
|
#
|
||||||
|
@ -5,8 +5,6 @@ require "test_runner_formula"
|
|||||||
require "github_runner"
|
require "github_runner"
|
||||||
|
|
||||||
class GitHubRunnerMatrix
|
class GitHubRunnerMatrix
|
||||||
# FIXME: Enable cop again when https://github.com/sorbet/sorbet/issues/3532 is fixed.
|
|
||||||
# rubocop:disable Style/MutableConstant
|
|
||||||
RunnerSpec = T.type_alias { T.any(LinuxRunnerSpec, MacOSRunnerSpec) }
|
RunnerSpec = T.type_alias { T.any(LinuxRunnerSpec, MacOSRunnerSpec) }
|
||||||
private_constant :RunnerSpec
|
private_constant :RunnerSpec
|
||||||
|
|
||||||
@ -27,7 +25,6 @@ class GitHubRunnerMatrix
|
|||||||
|
|
||||||
RunnerSpecHash = T.type_alias { T.any(LinuxRunnerSpecHash, MacOSRunnerSpecHash) }
|
RunnerSpecHash = T.type_alias { T.any(LinuxRunnerSpecHash, MacOSRunnerSpecHash) }
|
||||||
private_constant :RunnerSpecHash
|
private_constant :RunnerSpecHash
|
||||||
# rubocop:enable Style/MutableConstant
|
|
||||||
|
|
||||||
sig { returns(T::Array[GitHubRunner]) }
|
sig { returns(T::Array[GitHubRunner]) }
|
||||||
attr_reader :runners
|
attr_reader :runners
|
||||||
|
@ -159,7 +159,7 @@ class Object
|
|||||||
end
|
end
|
||||||
|
|
||||||
module MacOSVersions
|
module MacOSVersions
|
||||||
SYMBOLS = LazyObject.new do # rubocop:disable Style/MutableConstant
|
SYMBOLS = LazyObject.new do
|
||||||
odisabled "MacOSVersions::SYMBOLS", "MacOSVersion::SYMBOLS"
|
odisabled "MacOSVersions::SYMBOLS", "MacOSVersion::SYMBOLS"
|
||||||
MacOSVersion::SYMBOLS
|
MacOSVersion::SYMBOLS
|
||||||
end
|
end
|
||||||
@ -168,7 +168,7 @@ end
|
|||||||
module OS
|
module OS
|
||||||
module Mac
|
module Mac
|
||||||
# TODO: Replace `::Version` with `Version` when this is removed.
|
# TODO: Replace `::Version` with `Version` when this is removed.
|
||||||
Version = LazyObject.new do # rubocop:disable Style/MutableConstant
|
Version = LazyObject.new do
|
||||||
odisabled "OS::Mac::Version", "MacOSVersion"
|
odisabled "OS::Mac::Version", "MacOSVersion"
|
||||||
MacOSVersion
|
MacOSVersion
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user