From 73dc98d1c75bfd9b05bc3504d12356e420038b2b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 10 Oct 2020 19:29:49 +0200 Subject: [PATCH] Adjust RuboCop rules for Sorbet. --- Library/.rubocop.yml | 20 ++++++++++++++++++-- Library/Homebrew/.rubocop.yml | 4 ---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 7653a9495c..3a453e8c50 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -12,7 +12,12 @@ AllCops: DisplayCopNames: false # enable all pending rubocops NewCops: enable + Include: + - '**/*.rbi' Exclude: + - 'Homebrew/sorbet/rbi/gems/**/*.rbi' + - 'Homebrew/sorbet/rbi/hidden-definitions/**/*.rbi' + - 'Homebrew/sorbet/rbi/todo.rbi' - 'Homebrew/bin/*' - 'Homebrew/vendor/**/*' @@ -62,6 +67,10 @@ Naming/HeredocDelimiterNaming: ForbiddenDelimiters: - END, EOD, EOF +Naming/MethodName: + IgnoredPatterns: + - '\AHEAD\?\Z' + # Allow dashes in filenames. Naming/FileName: Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ @@ -264,9 +273,14 @@ Layout/LineLength: ' "~/Library/Application Support/', '"~/Library/Caches/', '"~/Application Support', ' was verified as official when first introduced to the cask'] -# Enable once we are using `sorbet-runtime`. Sorbet/FalseSigil: - Enabled: false + Exclude: + - 'Taps/**/*.rb' + - 'Homebrew/test/**/Casks/**/*.rb' + +Sorbet/StrictSigil: + Include: + - '**/*.rbi' # Try getting rid of these. Sorbet/ConstantsFromStrings: @@ -302,6 +316,7 @@ Style/ClassVars: Style/Documentation: Exclude: - 'Taps/**/*' + - '**/*.rbi' Style/DocumentationMethod: Include: @@ -313,6 +328,7 @@ Style/FrozenStringLiteralComment: Exclude: - 'Taps/*/*/{Formula,Casks,}/*.rb' - 'Homebrew/test/**/Casks/**/*.rb' + - '**/*.rbi' # TODO: remove this when possible. Style/GlobalVars: diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index 1cc3d8f301..e63152052f 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -45,10 +45,6 @@ Naming/PredicateName: # Can't rename these. AllowedMethods: is_32_bit?, is_64_bit? -Style/FrozenStringLiteralComment: - Exclude: - - '**/Casks/**/*.rb' - Style/HashAsLastArrayItem: Exclude: - 'test/utils/spdx_spec.rb'