Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(changelog): group regexps #3527

Merged
merged 5 commits into from Nov 7, 2022

Conversation

stevenh
Copy link
Contributor

@stevenh stevenh commented Nov 3, 2022

Fix the regular expressions used in changelog group processing to valid golang (RE2) regexps. These previously used PCRE character class \w which is not supported in RE2 which is what golang regexp uses.

Also document that format matches not just title as some may thing but the format <abbrev-commit> <title-commit>.

@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 3, 2022
@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Merging #3527 (ffe9559) into main (722463d) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3527      +/-   ##
==========================================
+ Coverage   84.26%   84.27%   +0.01%     
==========================================
  Files         114      114              
  Lines        9329     9338       +9     
==========================================
+ Hits         7861     7870       +9     
  Misses       1191     1191              
  Partials      277      277              
Impacted Files Coverage Δ
internal/pipe/changelog/changelog.go 91.72% <100.00%> (+0.26%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@stevenh stevenh marked this pull request as draft November 6, 2022 20:24
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 6, 2022
@stevenh
Copy link
Contributor Author

stevenh commented Nov 7, 2022

Had to roll back some changes which worked with the tests but didn't work in practice on github which has different output. I went with a conservative non greedy .*? as replacement for .* as the best we can do if the format varies per source control system.

@stevenh stevenh marked this pull request as ready for review November 7, 2022 00:05
@stevenh stevenh marked this pull request as draft November 7, 2022 11:19
Fix the regular expressions used in changelog group processing to valid
golang (RE2) regexps. These previously used PCRE character class \w which
is not supported in RE2 which is what golang regexp uses.

Document that format matches not just title as some may thing but
the format "<abbrev-commit> <title-commit>".

This also include "!" as defined by conventional commits.
Note changelog group regexp parameters are in RE2 syntax.
Use [[:xdigit:]] to match the abbrev-commit, which is clearer as to the
intent and correct as the previous version had a typo anyway.
GitHub has different output than the tests, including a colon after the
commit reference, so make the pattern resilient to that and other
nuisances by making it a full wild card but non greedy.

Also:
* Remove processed entries instead of striking them out, allowing early
  exit when we're done.
* Add group match debugging to users can see what's going on with --debug.
Fix invalid invalid index access in changelog processing when removing
processed items.
@stevenh stevenh marked this pull request as ready for review November 7, 2022 11:22
@caarlos0 caarlos0 merged commit 0ea4f1d into goreleaser:main Nov 7, 2022
@caarlos0
Copy link
Member

caarlos0 commented Nov 7, 2022

thank you!

@github-actions github-actions bot added this to the v1.13.0 milestone Nov 7, 2022
@stevenh stevenh deleted the fix/changelog-regexps branch November 7, 2022 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants