Skip to content

feat(dev-infra): validate breaking changes commit messages - #41274

Closed
alan-agius4 wants to merge 6 commits into
angular:masterfrom
alan-agius4:breaking-change-validator
Closed

alan-agius4 wants to merge 6 commits into
angular:masterfrom
alan-agius4:breaking-change-validator

Conversation

@alan-agius4

@alan-agius4 alan-agius4 commented Mar 19, 2021 •

Copy link
Copy Markdown
Contributor

With this change we valid breaking changes descriptions as per our contribution guidelines

See: https://github.com/angular/angular/blob/88fbc066775ab1a2f6a8c75f933375b46d8fa9a4/CONTRIBUTING.md#commit-message-footer

This gets me all the time.

@alan-agius4 alan-agius4 added target: major This PR is targeted for the next major release area: dev-infra Issues related to Angular's own dev infra (build, test, CI, releasing) labels Mar 19, 2021
@ngbot ngbot Bot added this to the Backlog milestone Mar 19, 2021
@google-cla google-cla Bot added the cla: yes label Mar 19, 2021
@ngbot ngbot Bot added this to the Backlog milestone Mar 19, 2021

@josephperrott josephperrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks!

@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Mar 19, 2021

@gkalpak gkalpak left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid there is no good way to validate a breaking change notice without failing for commits that happen to have lines starting with the phrase "breaking change" 😁

For example, with the current implementation the following messages would be considered invalid:

docs: add note about breaking changes

Breaking changes are not fun for developers. Mention that in the docs.

...or...

fix(foo): make it better

Fortunately, I was able to fix the bug in `foo` without introducing a
breaking change \o/

Yes, I understand some people don't like wrapping their commit message lines 😛
But others (read I) do and it is still what [we recommend][1] 🤔

Comment thread dev-infra/commit-message/validate.ts Resolved
Comment thread dev-infra/commit-message/validate.ts Resolved
@alan-agius4

Copy link
Copy Markdown
Contributor Author

@gkalpak, I think its a bit rare to have non breaking changes commit messages which start with the breaking change. I do agree that there is no perfect solution to remedy this.

That said, I think that validation of breaking changes commit messages is important especially considering that these are important to be included on the changelog.

Maybe I can skip validation for non caps BREAKING CHANGE text.

What do you think?

@alan-agius4
alan-agius4 requested a review from gkalpak March 19, 2021 15:58
@gkalpak

gkalpak commented Mar 19, 2021

Copy link
Copy Markdown
Member

Yes, it is rare, but I still don't think it is a good idea to fail over something as generic. For reference, I found 7 occurrences of commit messages body lines starting with breaking change as part of a sentence (not a breaking change notice) 😁

On the other hand, there are hundreds of incorrect breaking change notices, most of which are BREAKING CHANGES: (with an S) or BREAKING CHANGE (without the :). Also, I did not find any occurrence of BREAKING CHANGE outside of a breaking change notice 😁

Given the above, I think it is reasonable to validate lines starting with BREAKING CHANGE (uppercase).
(While we are still going to miss some, this will capture the majority of the invalid notices.)

@alan-agius4

Copy link
Copy Markdown
Contributor Author

@gkalpak PTAL

@alan-agius4 alan-agius4 removed the action: merge The PR is ready for merge by the caretaker label Mar 19, 2021
@alan-agius4
alan-agius4 requested review from gkalpak and removed request for gkalpak March 19, 2021 16:25

@gkalpak gkalpak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of nits. Otherwise lgtm 🚀
Thx for doing this, @alan-agius4 ✨

Comment thread dev-infra/commit-message/validate.ts Resolved
Comment on lines +186 to +190
print(`BREAKING CHANGE: <breaking change summary>`);
print();
print(`<breaking change description>`);
print();
print();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not thrilled about this:

  • 99% of the time it will not relevant 99% and could confuse beginner contributors.
  • It seems weird to show one (rare) part of the commit message footer and not show the (much more common) issue references.

But I don't feel strongly about it, so happy either way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add the issue reference as well?

@gkalpak gkalpak added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Mar 19, 2021
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Mar 19, 2021
@mhevery mhevery closed this in e8cae22 Mar 19, 2021
@alan-agius4
alan-agius4 deleted the breaking-change-validator branch March 19, 2021 19:41
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: dev-infra Issues related to Angular's own dev infra (build, test, CI, releasing) cla: yes target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants