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

Remove period from "Update draft release notes..." commit message #622

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

mokagio
Copy link
Contributor

@mokagio mokagio commented Dec 3, 2024

What does it do?

The first line of a commit message should not have a period (.)

I noticed this while looking at Automattic/pocket-casts-ios#2484 in the context of p1733261974076509-slack-C029BMLUGRX.

I am not aware of any official Git documentation for the statement above. However, it has been a convention in all the projects and companies I worked on.

The style is also present in the example commit message from the official Git book. See
https://git-scm.com/docs/MyFirstContribution#:~:text=You%20will%20be%20presented%20with%20your,A%20U%20Thor%20%3Cauthor%40example.com%3E

The style is also used in other sources, such as:

One could argue that the 50 to 72 character length and the period omission were characters economy constraints from back in the day of small screens and text-only interfaces. While that is true, I find the are many benefits in forcing oneself to be concise in the commit title/summary.

As for short line length, it works well for people like me, who use big font sizes because their eyes strain otherwise. 🤓

But aside from all the justifications above, having commit message titles without a period is the existing convention in this repo, which make this change a no-brainer.

Checklist before requesting a review

  • Run bundle exec rubocop to test for code style violations and recommendations
  • Add Unit Tests (aka specs/*_spec.rb) if applicable
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.

The first line of a commit message should not have a period (`.`)

I am not aware of any official Git documentation for the statement
above. However, it has been a convention in all the projects and
companies I worked on.

The style is also present in the example commit message from the
official Git book. See
https://git-scm.com/docs/MyFirstContribution#:~:text=You%20will%20be%20presented%20with%20your,A%20U%20Thor%20%3Cauthor%40example.com%3E

The style is also used in other sources, such as:

- https://commit.style/
- https://www.gitkraken.com/learn/git/best-practices/git-commit-message#using-imperative-verb-form
- https://thoughtbot.com/blog/5-useful-tips-for-a-better-commit-message

One could argue that the 50 to 72 character length and the period
omission were characters economy constraints from back in the day of
small screens and text-only interfaces. While that is true, I find the
are many benefits in forcing oneself to be concise in the commit
title/summary. As for short line length, it works well for people like
me, who use big font sizes because their eyes strain otherwise.

But aside from all the justifications above, having commit message
titles without a period is the existing convention in this repo, which
make this change a no brainer.
@mokagio mokagio requested a review from a team December 3, 2024 22:28
@mokagio mokagio marked this pull request as ready for review December 3, 2024 22:28
@@ -41,7 +41,7 @@ def self.extract_notes(release_notes_file_path, version)

def self.check_and_commit_extracted_notes_file(file_path, version)
Action.sh("git add #{file_path}")
Action.sh("git diff-index --quiet HEAD || git commit -m \"Update draft release notes for #{version}.\"")
Action.sh("git diff-index --quiet HEAD || git commit -m \"Update draft release notes for #{version}\"")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aside from the formatting, it would have been good to update the code to use either the Fastlane Git API or the git wrapper gem that I think we already have setup.

But I'm in the middle of my support rotation and already feel guilty for indulging in this fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

Took the liberty to do exactly that in 72b0592.

Tested by running extract_release_notes_for_version in a dummy branch of PCiOS, worked as expected (first run created the commit with changes to the release notes files, second call detected there was nothing new to commit)

@AliSoftware AliSoftware merged commit f9cc258 into trunk Dec 4, 2024
5 checks passed
@AliSoftware AliSoftware deleted the mokagio/remove-period-commit-msg-first-line branch December 4, 2024 10:34
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.

2 participants