Skip to content

Conversation

@ricab
Copy link
Collaborator

@ricab ricab commented May 31, 2025

Add a commit message template, a python script to serve as a validation hook, and a workflow to verify PR commits with that script.

MULTI-2014, MULTI-2015, MULTI-2016, MULTI-2017, MULTI-2018

@codecov
Copy link

codecov bot commented May 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.31%. Comparing base (5598edb) to head (fc0e0c5).

Additional details and impacted files
@@                   Coverage Diff                    @@
##           contribution-guidelines    #4129   +/-   ##
========================================================
  Coverage                    89.31%   89.31%           
========================================================
  Files                          259      259           
  Lines                        15684    15684           
========================================================
  Hits                         14008    14008           
  Misses                        1676     1676           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricab ricab force-pushed the commit-msg-std branch 2 times, most recently from 6ba0e31 to 62445ee Compare June 17, 2025 20:59
@ricab ricab force-pushed the commit-msg-std branch from 62445ee to 398cb69 Compare July 4, 2025 15:22
@ricab ricab changed the base branch from main to contribution-guidelines July 4, 2025 15:25
@ricab ricab force-pushed the contribution-guidelines branch from 5598edb to ea47b98 Compare July 10, 2025 16:30
@ricab ricab force-pushed the contribution-guidelines branch from ea47b98 to 22a47f3 Compare July 12, 2025 00:34
@ricab ricab force-pushed the commit-msg-std branch 2 times, most recently from 25d7bb9 to 7231fa0 Compare July 12, 2025 00:42
@ricab
Copy link
Collaborator Author

ricab commented Jul 23, 2025

OK, I think this is ready (provided the base merges).

Here is a workflow run with bad commits: https://github.com/canonical/multipass/actions/runs/16480729443/job/46594055132?pr=4272

@sharder996, would you recommend having this workflow in the branch protection, or as part of dynamic CI?

@ricab ricab marked this pull request as ready for review July 23, 2025 20:12
Base automatically changed from contribution-guidelines to main July 24, 2025 00:08
@ricab ricab marked this pull request as draft August 19, 2025 16:34
@ricab ricab marked this pull request as ready for review August 19, 2025 16:34
ricab added 21 commits August 19, 2025 17:38
Give up checking whether rule 9 holds because there is no way to know
with certainty whether a sentence-ending line also ends the paragraph,
without relying on a blank line to separate it from the following one.
As, for example, in the previous line and this one :)

We could detect cases where the first word(s) of the following line
could still fit in the line that ended the sentence, but that could also
be just a case of poor wrapping. For example:

This is a sentence.
And this is another one.

There is no way to decide if the above is a case of a paragraph without
a blank line or just sub-optimal wrapping. I am opting not to enforce
optimal wrapping at this point, since it is not explicitly required by
the current rules. And poems should be allowed :)
Fix commit verification not failing due to sub-shell not updating outer
variable that was used to indicate failure. Use a file instead.
@levkropp levkropp self-requested a review August 19, 2025 17:05
Copy link
Contributor

@levkropp levkropp left a comment

Choose a reason for hiding this comment

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

Yep LGTM! Getting used to capitalizing the first word of every commit will take some time 😅

- Consider setting your commit template to the .gitmessage file in the repository root:
* `git config --local commit.template .gitmessage`
- Consider adding the commit-msg file in the repository root as a git hook (in .git/hooks)
* `ln -s ../../git-hooks/commit-msg.py .git/hooks/commit-msg`
Copy link
Member

Choose a reason for hiding this comment

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

This would probably fail if one switches back to an older branch. I've tested with main, git didn't complain, so it shouldn't be an issue.

Copy link
Member

@xmkg xmkg left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ricab ricab added this pull request to the merge queue Aug 21, 2025
Merged via the queue into main with commit 05508b2 Aug 21, 2025
10 checks passed
@ricab ricab deleted the commit-msg-std branch August 21, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants