From 2b029b2744c1a008b17c588313963051a291f13c Mon Sep 17 00:00:00 2001
From: Markus Reiter <me@reitermark.us>
Date: Mon, 31 Aug 2020 00:13:15 +0200
Subject: [PATCH] Remove need for separate `.rubocop_cask.yml`.

---
 Library/.rubocop.yml               | 28 ++++++++++++++++++++--
 Library/.rubocop_cask.yml          | 37 +++---------------------------
 Library/Homebrew/cask/cmd/style.rb |  2 +-
 3 files changed, 30 insertions(+), 37 deletions(-)

diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml
index dc1ee29a3c..7fb214b2f4 100644
--- a/Library/.rubocop.yml
+++ b/Library/.rubocop.yml
@@ -8,6 +8,30 @@ AllCops:
   # enable all pending rubocops
   NewCops: enable
 
+Cask/Desc:
+  Description: 'Ensure that the desc stanza conforms to various content and style checks.'
+  Enabled: true
+
+Cask/HomepageMatchesUrl:
+  Description: 'Ensure that the homepage and url match, otherwise add a comment. More info at https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment'
+  Enabled: true
+
+Cask/HomepageUrlTrailingSlash:
+  Description: 'Ensure that the homepage url has a slash after the domain name.'
+  Enabled: true
+
+Cask/NoDslVersion:
+  Description: 'Do not use the deprecated DSL version syntax in your cask header.'
+  Enabled: true
+
+Cask/StanzaGrouping:
+  Description: 'Ensure that cask stanzas are grouped correctly. More info at https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/cask_language_reference/readme.md#stanza-order'
+  Enabled: true
+
+Cask/StanzaOrder:
+  Description: 'Ensure that cask stanzas are sorted correctly. More info at https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/cask_language_reference/readme.md#stanza-order'
+  Enabled: true
+
 # enable all formulae audits
 FormulaAudit:
   Enabled: true
@@ -195,11 +219,11 @@ Style/ClassVars:
   Exclude:
   - '**/developer/bin/*'
 
-# most of our APIs are internal so don't require docs
+# Don't enforce documentation in casks or formulae.
 Style/Documentation:
  Enabled: false
 
-# don't want this for formulae but re-enabled for Library/Homebrew
+# Not used for casks and formulae.
 Style/FrozenStringLiteralComment:
   Enabled: false
 
diff --git a/Library/.rubocop_cask.yml b/Library/.rubocop_cask.yml
index e4c4939a38..363cf3c79d 100644
--- a/Library/.rubocop_cask.yml
+++ b/Library/.rubocop_cask.yml
@@ -1,35 +1,4 @@
-inherit_from: ./Homebrew/.rubocop.yml
-
-Cask/Desc:
-  Description: 'Ensure that the desc stanza conforms to various content and style checks.'
-  Enabled: true
-
-Cask/HomepageMatchesUrl:
-  Description: 'Ensure that the homepage and url match, otherwise add a comment. More info at https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment'
-  Enabled: true
-
-Cask/HomepageUrlTrailingSlash:
-  Description: 'Ensure that the homepage url has a slash after the domain name.'
-  Enabled: true
-
-Cask/NoDslVersion:
-  Description: 'Do not use the deprecated DSL version syntax in your cask header.'
-  Enabled: true
+# TODO: This file can be deleted once https://github.com/Homebrew/brew/pull/8542
+# is in a stable release and `rubocop.yml` has been removed from all cask taps.
 
-Cask/StanzaGrouping:
-  Description: 'Ensure that cask stanzas are grouped correctly. More info at https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/cask_language_reference/readme.md#stanza-order'
-  Enabled: true
-
-Cask/StanzaOrder:
-  Description: 'Ensure that cask stanzas are sorted correctly. More info at https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/cask_language_reference/readme.md#stanza-order'
-  Enabled: true
-
-# don't want these for casks but re-enabled for Library/Homebrew
-Style/FrozenStringLiteralComment:
-  Enabled: false
-
-Style/Documentation:
-  Enabled: false
-
-Metrics/BlockLength:
-  Enabled: false
+inherit_from: ./Homebrew/.rubocop.yml
diff --git a/Library/Homebrew/cask/cmd/style.rb b/Library/Homebrew/cask/cmd/style.rb
index 7db1ac6b57..1ae95409ca 100644
--- a/Library/Homebrew/cask/cmd/style.rb
+++ b/Library/Homebrew/cask/cmd/style.rb
@@ -27,7 +27,7 @@ module Cask
 
         args = [
           "--force-exclusion",
-          "--config", "#{HOMEBREW_LIBRARY}/.rubocop_cask.yml"
+          "--config", HOMEBREW_LIBRARY/".rubocop.yml"
         ]
 
         if json
-- 
GitLab