Repository: goreleaser/goreleaser
Pull request #3117 (2022-05-20 01:17:54)

fix: brew formula class generation when using dots
Resolves: #3116

Change homebrew class generation to match what homebrew expects based on [Homebrew's code](https://github.com/Homebrew/brew/blob/master/Library/Homebrew/formulary.rb#L150-L156) for generating class names.



codecov[bot]: # [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/3117?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) Report
> Merging [#3117](https://codecov.io/gh/goreleaser/goreleaser/pull/3117?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (5f22a60) into [main](https://codecov.io/gh/goreleaser/goreleaser/commit/cc27fba6278dbbba14068a333c4dd02147a96b42?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) (cc27fba) will **decrease** coverage by `0.24%`.
> The diff coverage is `100.00%`.

> :exclamation: Current head 5f22a60 differs from pull request most recent head 4dc9b72. Consider uploading reports for the commit 4dc9b72 to get more accurate results

```diff
@@            Coverage Diff             @@
##             main    #3117      +/-   ##
==========================================
- Coverage   84.66%   84.41%   -0.25%     
==========================================
  Files         113      113              
  Lines        9273     9300      +27     
==========================================
  Hits         7851     7851              
- Misses       1149     1176      +27     
  Partials      273      273              
```


| [Impacted Files](https://codecov.io/gh/goreleaser/goreleaser/pull/3117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser) | Coverage Δ | |
|---|---|---|
| [internal/pipe/brew/brew.go](https://codecov.io/gh/goreleaser/goreleaser/pull/3117/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser#diff-aW50ZXJuYWwvcGlwZS9icmV3L2JyZXcuZ28=) | `84.36% <100.00%> (ø)` | |
| [internal/client/github.go](https://codecov.io/gh/goreleaser/goreleaser/pull/3117/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser#diff-aW50ZXJuYWwvY2xpZW50L2dpdGh1Yi5nbw==) | `34.45% <0.00%> (-3.46%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/3117?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/goreleaser/goreleaser/pull/3117?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser). Last update [cc27fba...4dc9b72](https://codecov.io/gh/goreleaser/goreleaser/pull/3117?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=goreleaser).


Patch:
diff --git a/internal/pipe/brew/brew.go b/internal/pipe/brew/brew.go
index 83b87759..0a050503 100644
--- a/internal/pipe/brew/brew.go
+++ b/internal/pipe/brew/brew.go
@@ -408,7 +408,7 @@ func split(s string) []string {
 func formulaNameFor(name string) string {
 	name = strings.ReplaceAll(name, "-", " ")
 	name = strings.ReplaceAll(name, "_", " ")
-	name = strings.ReplaceAll(name, ".", "_")
+	name = strings.ReplaceAll(name, ".", "")
 	name = strings.ReplaceAll(name, "@", "AT")
 	return strings.ReplaceAll(strings.Title(name), " ", "") // nolint:staticcheck
 }


Test patch:
diff --git a/internal/pipe/brew/brew_test.go b/internal/pipe/brew/brew_test.go
index 99e16d45..62d6529d 100644
--- a/internal/pipe/brew/brew_test.go
+++ b/internal/pipe/brew/brew_test.go
@@ -28,7 +28,7 @@ func TestNameWithUnderline(t *testing.T) {
 }
 
 func TestNameWithDots(t *testing.T) {
-	require.Equal(t, formulaNameFor("binaryv0.0.0"), "Binaryv0_0_0")
+	require.Equal(t, formulaNameFor("binaryv0.0.0"), "Binaryv000")
 }
 
 func TestNameWithAT(t *testing.T) {