Rules for commit messages

Part of KTI-944 about adding automatic checks to commit messages.
This commit is contained in:
Nikolay Krasko
2022-10-05 12:18:59 +02:00
committed by teamcity
parent 0080f16cc2
commit 2ea0cdf46d
2 changed files with 30 additions and 1 deletions
Generated
+1 -1
View File
@@ -4,7 +4,7 @@
<profile version="1.0">
<inspection_tool class="BodyLimit" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="GrazieCommit" enabled="true" level="TYPO" enabled_by_default="true" />
<inspection_tool class="SubjectBodySeparation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SubjectBodySeparation" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="SubjectLimit" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
+29
View File
@@ -60,6 +60,35 @@ git config --global pull.rebase true
This will avoid your local repo having too many merge commits
which will help keep your pull request simple and easy to apply.
## Rules for commit messages
Most of these rules are originated from the [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/)
article, and it's highly recommended to read it.
### Rules on commit messages' content
1. Use the body to explain what and why vs. how
* Please make an extra effort to explain why changes are needed for every non-trivial modification.
2. Significant commits must mention relevant [YouTrack](https://youtrack.jetbrains.com/issues/KT) issues in their messages
3. Commit changes together with the corresponding tests, unless the resulting commit becomes too unwieldy to grasp
4. Try to avoid commits like *"Fixes after review"* whenever it's possible and squash them with meaningful ones instead
5. Keep the subject (first line of the commit message) clean and readable. All additional information and directives for external tools
should be moved to the message body.
6. If you mention “*^[KTIJ-235](https://youtrack.jetbrains.com/issue/KTIJ-235) Fixed*” in the message body - then the VCS integration will
add *Fix in Builds* field to the issue in the YouTrack and automatically mark issue as fixed. For details see
[YouTrack Integrations](https://www.jetbrains.com/youtrack/features/integrations.html) and
[Apply Commands in VCS Commits](https://www.jetbrains.com/help/youtrack/server/Apply-Commands-in-VCS-Commits.html).
### Rules on commit messages' style/formatting
1. Separate subject from body with a blank line
2. Capitalize the subject line
3. Do not end the subject line with a period
4. Use the imperative mood in the subject line
5. Limit the commit messages lines to 72 characters
* Use “Commit Message Inspections” in IntelliJ IDE *Settings -> Version Control -> Commit*
* vim: ```autocmd FileType gitcommit setlocal textwidth=72```
## Checklist
Before submitting the pull request, make sure that you can say "YES" to each point in this short checklist: