From e05cd2c5423d3813384ecce83e1b9cc8e54c8dcb Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 2 Mar 2023 22:10:16 +0000 Subject: [PATCH 1/3] rubocop: In-line `Style/HashAsLastArrayItem` disablement - We want to move away from `Excludes:` in the main `.rubocop.yml` config file containing full file paths, because it's hard to track whether they're still necessary or not (and other occurrences in the files that you might legitimately want to improve are unaccounted for). --- Library/Homebrew/.rubocop.yml | 4 ---- Library/Homebrew/test/utils/spdx_spec.rb | 6 ++++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index 74c41a77b6..c1601ee534 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -65,9 +65,5 @@ Style/DocumentationMethod: Include: - "formula.rb" -Style/HashAsLastArrayItem: - Exclude: - - "test/utils/spdx_spec.rb" - Bundler/GemFilename: Enabled: false diff --git a/Library/Homebrew/test/utils/spdx_spec.rb b/Library/Homebrew/test/utils/spdx_spec.rb index 8d84bb03e1..b3a78550e6 100644 --- a/Library/Homebrew/test/utils/spdx_spec.rb +++ b/Library/Homebrew/test/utils/spdx_spec.rb @@ -81,7 +81,7 @@ describe SPDX do license_expression = { any_of: [ "MIT", :public_domain, - all_of: ["0BSD", "Zlib"], + all_of: ["0BSD", "Zlib"], # rubocop:disable Style/HashAsLastArrayItem "curl" => { with: "LLVM-exception" }, ] } result = [["MIT", :public_domain, "curl", "0BSD", "Zlib"], ["LLVM-exception"]] @@ -201,7 +201,7 @@ describe SPDX do license_expression = { any_of: [ "MIT", :public_domain, - all_of: ["0BSD", "Zlib"], + all_of: ["0BSD", "Zlib"], # rubocop:disable Style/HashAsLastArrayItem "curl" => { with: "LLVM-exception" }, ] } result = "MIT or Public Domain or (0BSD and Zlib) or (curl with LLVM-exception)" @@ -229,6 +229,7 @@ describe SPDX do }) end + # rubocop:disable Style/HashAsLastArrayItem it "handles nested brackets" do expect(described_class.string_to_license_expression("A and (B or (C and D))")).to eq({ all_of: [ @@ -240,6 +241,7 @@ describe SPDX do ], }) end + # rubocop:enable Style/HashAsLastArrayItem end describe ".license_version_info" do From 81b0e4118375457f33447e047effec50e18ff2d4 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 2 Mar 2023 22:13:55 +0000 Subject: [PATCH 2/3] rubocop: Alphabetize list of cops, put `Bundler/GemFilename` first --- Library/Homebrew/.rubocop.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index c1601ee534..e8a25dfd6a 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -1,6 +1,9 @@ inherit_from: - ../.rubocop.yml +Bundler/GemFilename: + Enabled: false + Homebrew/MoveToExtendOS: Enabled: true Exclude: @@ -64,6 +67,3 @@ Style/Documentation: Style/DocumentationMethod: Include: - "formula.rb" - -Bundler/GemFilename: - Enabled: false From 2091ef61fdf00ed2fb1089caa787382e85d42733 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 2 Mar 2023 22:33:28 +0000 Subject: [PATCH 3/3] rubocop: The default `Style/FormatStringToken` style is "annotated" --- Library/.rubocop.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 927bbd4bab..83db175afd 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -377,11 +377,6 @@ Style/FetchEnvVar: - "/**/Formula/**/*.rb" - "**/Formula/**/*.rb" -# Prefer tokens with type annotations for consistency -# between formatting numbers and strings. -Style/FormatStringToken: - EnforcedStyle: annotated - # Not used for casks and formulae. Style/FrozenStringLiteralComment: EnforcedStyle: always