Repository: goreleaser/goreleaser
Pull request #2001 (2021-01-07 06:16:28)

fix: Adds comments to formula template to conform to 'brew audit --strict --online'
<!--

Hi, thanks for contributing!

Please make sure you read our CONTRIBUTING guide.

Please fill the fields above:

-->

<!-- If applied, this commit will... -->

This PR adds missing comments required for `brew audit --strict --online`:

```ruby
# typed: false
# frozen_string_literal: true

...
```

<!-- Why is this change being made? -->

If you run `brew audit --strict --online` on a formula generated by GoReleaser, you'll be met with the following:

```bash
  * 1: col 1: No Sorbet sigil found in file. Try a `typed: false` to start (you can also use `rubocop -a` to automatically add this).
  * 1: col 1: Missing frozen string literal comment.
```

For these formula to conform to `brew audit` rules, we'll need these comment strings added to the top of the brew template. This is important especially if you have CI/CD rules setup to automatically install/audit a homebrew tap. Those formula automatically generated with GoReleaser will fail the audit command without these changes.

<!-- # Provide links to any relevant tickets, URLs or other resources -->



vercel[bot]: @Justintime50 is attempting to deploy a commit to the **Goreleaser** Team on [Vercel](https://vercel.com).

A member of the Team first needs to [authorize it](https://vercel.com/git/authorize?team=Goreleaser&type=github&job=%7B%22headInfo%22%3A%7B%22sha%22%3A%224fbabbe4b14452a0b6254950ea5e6c619feb571b%22%7D%2C%22id%22%3A%22Qmc9JPiu4f1w11wzgSe5dTVuzRSfHTsncfBuxi9bv399fg%22%2C%22org%22%3A%22goreleaser%22%2C%22prId%22%3A2001%2C%22repo%22%3A%22goreleaser%22%7D).


Justintime50: Do I need to authorize/create an account with Vercel on my end or is that something on your team's end?
codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2001?src=pr&el=h1) Report
> Merging [#2001](https://codecov.io/gh/goreleaser/goreleaser/pull/2001?src=pr&el=desc) (636ce63) into [master](https://codecov.io/gh/goreleaser/goreleaser/commit/a52b1482b40eaf7c5d064b3c9344ad06bdeb398a?el=desc) (a52b148) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/goreleaser/goreleaser/pull/2001/graphs/tree.svg?width=650&height=150&src=pr&token=3bJvv6b7hN)](https://codecov.io/gh/goreleaser/goreleaser/pull/2001?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #2001   +/-   ##
=======================================
  Coverage   82.83%   82.83%           
=======================================
  Files          74       74           
  Lines        3980     3980           
=======================================
  Hits         3297     3297           
  Misses        556      556           
  Partials      127      127           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2001?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/2001?src=pr&el=footer). Last update [a52b148...636ce63](https://codecov.io/gh/goreleaser/goreleaser/pull/2001?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/internal/pipe/brew/template.go b/internal/pipe/brew/template.go
index 3e88b1c3..177244e2 100644
--- a/internal/pipe/brew/template.go
+++ b/internal/pipe/brew/template.go
@@ -29,7 +29,10 @@ type downloadable struct {
 	SHA256      string
 }
 
-const formulaTemplate = `# This file was generated by GoReleaser. DO NOT EDIT.
+const formulaTemplate = `# typed: false
+# frozen_string_literal: true
+
+# This file was generated by GoReleaser. DO NOT EDIT.
 {{ if .CustomRequire -}}
 require_relative "{{ .CustomRequire }}"
 {{ end -}}


Test patch:
diff --git a/internal/pipe/brew/testdata/binary_overridden.rb.golden b/internal/pipe/brew/testdata/binary_overridden.rb.golden
index 57fbdd10..75bc881e 100644
--- a/internal/pipe/brew/testdata/binary_overridden.rb.golden
+++ b/internal/pipe/brew/testdata/binary_overridden.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class BinaryOverridden < Formula
   desc "A run pipe test formula"
diff --git a/internal/pipe/brew/testdata/custom_block.rb.golden b/internal/pipe/brew/testdata/custom_block.rb.golden
index 57000dcd..d5ffa733 100644
--- a/internal/pipe/brew/testdata/custom_block.rb.golden
+++ b/internal/pipe/brew/testdata/custom_block.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class CustomBlock < Formula
   desc "A run pipe test formula and FOO=foo_is_bar"
diff --git a/internal/pipe/brew/testdata/custom_download_strategy.rb.golden b/internal/pipe/brew/testdata/custom_download_strategy.rb.golden
index 09674200..af685d87 100644
--- a/internal/pipe/brew/testdata/custom_download_strategy.rb.golden
+++ b/internal/pipe/brew/testdata/custom_download_strategy.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class CustomDownloadStrategy < Formula
   desc "A run pipe test formula and FOO=foo_is_bar"
diff --git a/internal/pipe/brew/testdata/custom_require.rb.golden b/internal/pipe/brew/testdata/custom_require.rb.golden
index 33819dcc..3a3ae4d5 100644
--- a/internal/pipe/brew/testdata/custom_require.rb.golden
+++ b/internal/pipe/brew/testdata/custom_require.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 require_relative "custom_download_strategy"
 class CustomRequire < Formula
diff --git a/internal/pipe/brew/testdata/default.rb.golden b/internal/pipe/brew/testdata/default.rb.golden
index ea5e0fc4..b7231ac6 100644
--- a/internal/pipe/brew/testdata/default.rb.golden
+++ b/internal/pipe/brew/testdata/default.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class Default < Formula
   desc "A run pipe test formula and FOO=foo_is_bar"
diff --git a/internal/pipe/brew/testdata/default_gitlab.rb.golden b/internal/pipe/brew/testdata/default_gitlab.rb.golden
index b58c7619..c8fb41f5 100644
--- a/internal/pipe/brew/testdata/default_gitlab.rb.golden
+++ b/internal/pipe/brew/testdata/default_gitlab.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class DefaultGitlab < Formula
   desc "A run pipe test formula and FOO=foo_is_bar"
diff --git a/internal/pipe/brew/testdata/foo_is_bar.rb.golden b/internal/pipe/brew/testdata/foo_is_bar.rb.golden
index 68f22f7e..46ef06ac 100644
--- a/internal/pipe/brew/testdata/foo_is_bar.rb.golden
+++ b/internal/pipe/brew/testdata/foo_is_bar.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class FooIsBar < Formula
   desc ""
diff --git a/internal/pipe/brew/testdata/multiple_armv5.rb.golden b/internal/pipe/brew/testdata/multiple_armv5.rb.golden
index e5e7b281..0c7e8ce1 100644
--- a/internal/pipe/brew/testdata/multiple_armv5.rb.golden
+++ b/internal/pipe/brew/testdata/multiple_armv5.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class MultipleArmv5 < Formula
   desc "A run pipe test formula and FOO=foo_is_bar"
diff --git a/internal/pipe/brew/testdata/multiple_armv6.rb.golden b/internal/pipe/brew/testdata/multiple_armv6.rb.golden
index 0028051a..6d2f24bc 100644
--- a/internal/pipe/brew/testdata/multiple_armv6.rb.golden
+++ b/internal/pipe/brew/testdata/multiple_armv6.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class MultipleArmv6 < Formula
   desc "A run pipe test formula and FOO=foo_is_bar"
diff --git a/internal/pipe/brew/testdata/multiple_armv7.rb.golden b/internal/pipe/brew/testdata/multiple_armv7.rb.golden
index 1c638a25..759c53ab 100644
--- a/internal/pipe/brew/testdata/multiple_armv7.rb.golden
+++ b/internal/pipe/brew/testdata/multiple_armv7.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class MultipleArmv7 < Formula
   desc "A run pipe test formula and FOO=foo_is_bar"
diff --git a/internal/pipe/brew/testdata/test.rb.golden b/internal/pipe/brew/testdata/test.rb.golden
index f81eb302..38b876bf 100644
--- a/internal/pipe/brew/testdata/test.rb.golden
+++ b/internal/pipe/brew/testdata/test.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class Test < Formula
   desc "Some desc"
diff --git a/internal/pipe/brew/testdata/test_linux_only.rb.golden b/internal/pipe/brew/testdata/test_linux_only.rb.golden
index 1a906720..f18815b7 100644
--- a/internal/pipe/brew/testdata/test_linux_only.rb.golden
+++ b/internal/pipe/brew/testdata/test_linux_only.rb.golden
@@ -1,3 +1,6 @@
+# typed: false
+# frozen_string_literal: true
+
 # This file was generated by GoReleaser. DO NOT EDIT.
 class Test < Formula
   desc "Some desc"