Commit Policy: Difference between revisions
Jump to navigation
Jump to search
(→Change Log: Add [Deprecation Notices] as a recognised tag (seen in use by Thiago in the wild).) |
mNo edit summary |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Developing_Qt::Guidelines]] | [[Category:Developing_Qt::Guidelines]] | ||
[[Category:Developing Qt::Process]] | |||
[[Category:Tools::Gerrit]] | |||
These are the general rules for creating and pushing commits to any shared Qt repositories. As usual at Qt, none of these rules is set in stone, but you '''will''' be subject of public reprimand if you violate them without good reason. | These are the general rules for creating and pushing commits to any shared Qt repositories. As usual at Qt, none of these rules is set in stone, but you '''will''' be subject of public reprimand if you violate them without good reason. | ||
# If you add new functions/classes: | #If you add new functions/classes: | ||
## Ensure everything is documented properly. | ##Ensure everything is documented properly. | ||
## Follow the [[API Design Principles]]. Discuss and verify the names of functions/classes with other Qt developers (conduct API reviews). | ##Follow the [[API Design Principles]]. Discuss and verify the names of functions/classes with other Qt developers (conduct API reviews). | ||
# Make the new/changed code follow the [[Qt_Coding_Style|coding style]] and [[Coding_Conventions|coding conventions]]. | #Make the new/changed code follow the [[Qt_Coding_Style|coding style]] and [[Coding_Conventions|coding conventions]]. | ||
# For GUI code, follow the [http://techbase.kde.org/Projects/Usability/HIG style guide] , the [[Qt_Creator_Translation_Page|Qt Creator translation hints]] and avoid [http://techbase.kde.org/Development/Tutorials/Localization/i18n_Mistakes internationalization mistakes]. | #For GUI code, follow the [http://techbase.kde.org/Projects/Usability/HIG style guide] , the [[Qt_Creator_Translation_Page|Qt Creator translation hints]] and avoid [http://techbase.kde.org/Development/Tutorials/Localization/i18n_Mistakes internationalization mistakes]. | ||
# Ensure your change compiles and works on all platforms, also when Qt is [[Qt In Namespace|built in a namespace]]. The CI system rejects broken changes. | #Ensure your change compiles and works on all platforms, also when Qt is [[Qt In Namespace|built in a namespace]]. The CI system rejects broken changes. | ||
# Verify that there are no regressions in the unit tests (see [[Qt Autotest Environment]] for more info). | #Verify that there are no regressions in the unit tests (see [[Qt Autotest Environment]] for more info). | ||
# Write new unit tests for the bugs you fixed or functionality you added. | #Write new unit tests for the bugs you fixed or functionality you added. | ||
# Do not commit anything you do not understand. "Somehow it suddenly works" is not acceptable. Reverting when a proper fix would be possible is admitting defeat. ;) | #Do not commit anything you do not understand. "Somehow it suddenly works" is not acceptable. Reverting when a proper fix would be possible is admitting defeat. ;) | ||
# Produce commits which facilitate reviews and contribute to a useful history which can be read, searched, annotated and cherry-picked. In particular: | #Produce commits which facilitate reviews and contribute to a useful history which can be read, searched, annotated and cherry-picked. If you have Qt's standard commit-hooks set up, the [[Early Warning System]] will offer you some advice on this (and Gerrit will run the same script with more checks). In particular: | ||
## Make atomic commits. That means that each commit should contain exactly one self-contained change - do not mix unrelated changes, and do not create inconsistent states. Never "hide" unrelated fixes in bigger commits. Fix the coding style only in exactly the lines which contain the functional changes, and fix comments only when they relate to the change - the rest is for a separate commit. | ##Make atomic commits. That means that each commit should contain exactly one self-contained change - do not mix unrelated changes, and do not create inconsistent states. Never "hide" unrelated fixes in bigger commits. Fix the coding style only in exactly the lines which contain the functional changes, and fix comments only when they relate to the change - the rest is for a separate commit. | ||
## Write descriptive commit messages. | ##Write descriptive commit messages (following [http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html generic Git commit message guidelines]) | ||
## Commit often. Use <tt>git gui</tt> (or <tt>tig</tt>) and <tt>git rebase -i</tt> extensively to get your unpublished history into shape. Note that pushing to your private clone does ''not'' count as publishing and is a perfectly valid way to solicit an early review or to make a backup of a work in progress. Further reading: [http://sandofsky.com/blog/git-workflow.html Understanding the Git Workflow] | ###Use the commit subject to describe the ''cure'' (what the commit does), not the symptoms or disease (the bug/issue it fixes). Avoid variants of <code>Fix <title of JIRA bug></code>. | ||
# Make sure to follow the [[Branch Guidelines]]. Submit against the lowest applicable branch from which a release is still planned | ###Tell ''why'' you changed something unless it is completely self-evident; this is particularly important for reverts. | ||
# Review your changes before you push to Gerrit. <tt>git gpush --list[-online]</tt>, <tt>git log [--stat] [--summary] [-p] @{u}..</tt> and <tt>gitk</tt> are your friends. | ###Make the commit self-contained, so people do not have to research the historical context to make sense of it. Conversely, do not add unnecessary trivia. | ||
# Pay attention to what git and Gerrit are telling you. If something unusual happens, don't shrug it off. | ###Use the [http://code.qt.io/cgit/qt/qt5.git/tree/.commit-template Qt commit template]. Follow the summary + description message style and use footers to reference JIRA issues, collaborators, etc. | ||
##Commit often. Use <tt>git gui</tt> (or <tt>tig</tt>) and <tt>git rebase -i</tt> extensively to get your unpublished history into shape. Note that pushing to your private clone does ''not'' count as publishing and is a perfectly valid way to solicit an early review or to make a backup of a work in progress. Further reading: [http://sandofsky.com/blog/git-workflow.html Understanding the Git Workflow] | |||
#Make sure to follow the [[Branch Guidelines]]. Submit against dev and include a Pick-to footer, listing released versions back to the lowest applicable branch from which a release is still planned, that your change is relevant to. | |||
#Review your changes before you push to Gerrit. <tt>git gpush --list[-online]</tt>, <tt>git log [--stat] [--summary] [-p] @{u}..</tt> and <tt>gitk</tt> are your friends. | |||
#Pay attention to what git and Gerrit are telling you. If something unusual happens, don't shrug it off. | |||
Next, follow the [[Review Policy]]. | Next, follow the [[Review Policy]]. | ||
== Change Log == | ==Change Log== | ||
If the change is significant and affects many users, compatibility, or is a noteworthy feature, you must add a ChangeLog entry. | If the change is significant and affects many users, compatibility, or is a noteworthy feature, you must add a ChangeLog entry. | ||
== Additional notes == | For more information, see: https://contribute.qt-project.org/quips/17 | ||
==Additional notes== | |||
* When you commit translations, use "make commit-ts" instead of "git commit" to keep the line number information out of the committed files. | *When you commit translations, use "make commit-ts" instead of "git commit" to keep the line number information out of the committed files. | ||
* For non-native English speakers who'd like any written English (code comments and documentation in general) to be reviewed, feel free to add one of the people listed under the Approvers and Editors section [[:Category:Developing Qt::Documentation#Approvers_and_Editors|here]]. | *For non-native English speakers who'd like any written English (code comments and documentation in general) to be reviewed, feel free to add one of the people listed under the Approvers and Editors section [[:Category:Developing Qt::Documentation#Approvers_and_Editors|here]]. |
Latest revision as of 08:22, 2 September 2024
These are the general rules for creating and pushing commits to any shared Qt repositories. As usual at Qt, none of these rules is set in stone, but you will be subject of public reprimand if you violate them without good reason.
- If you add new functions/classes:
- Ensure everything is documented properly.
- Follow the API Design Principles. Discuss and verify the names of functions/classes with other Qt developers (conduct API reviews).
- Make the new/changed code follow the coding style and coding conventions.
- For GUI code, follow the style guide , the Qt Creator translation hints and avoid internationalization mistakes.
- Ensure your change compiles and works on all platforms, also when Qt is built in a namespace. The CI system rejects broken changes.
- Verify that there are no regressions in the unit tests (see Qt Autotest Environment for more info).
- Write new unit tests for the bugs you fixed or functionality you added.
- Do not commit anything you do not understand. "Somehow it suddenly works" is not acceptable. Reverting when a proper fix would be possible is admitting defeat. ;)
- Produce commits which facilitate reviews and contribute to a useful history which can be read, searched, annotated and cherry-picked. If you have Qt's standard commit-hooks set up, the Early Warning System will offer you some advice on this (and Gerrit will run the same script with more checks). In particular:
- Make atomic commits. That means that each commit should contain exactly one self-contained change - do not mix unrelated changes, and do not create inconsistent states. Never "hide" unrelated fixes in bigger commits. Fix the coding style only in exactly the lines which contain the functional changes, and fix comments only when they relate to the change - the rest is for a separate commit.
- Write descriptive commit messages (following generic Git commit message guidelines)
- Use the commit subject to describe the cure (what the commit does), not the symptoms or disease (the bug/issue it fixes). Avoid variants of .
Fix <title of JIRA bug>
- Tell why you changed something unless it is completely self-evident; this is particularly important for reverts.
- Make the commit self-contained, so people do not have to research the historical context to make sense of it. Conversely, do not add unnecessary trivia.
- Use the Qt commit template. Follow the summary + description message style and use footers to reference JIRA issues, collaborators, etc.
- Use the commit subject to describe the cure (what the commit does), not the symptoms or disease (the bug/issue it fixes). Avoid variants of
- Commit often. Use git gui (or tig) and git rebase -i extensively to get your unpublished history into shape. Note that pushing to your private clone does not count as publishing and is a perfectly valid way to solicit an early review or to make a backup of a work in progress. Further reading: Understanding the Git Workflow
- Make sure to follow the Branch Guidelines. Submit against dev and include a Pick-to footer, listing released versions back to the lowest applicable branch from which a release is still planned, that your change is relevant to.
- Review your changes before you push to Gerrit. git gpush --list[-online], git log [--stat] [--summary] [-p] @{u}.. and gitk are your friends.
- Pay attention to what git and Gerrit are telling you. If something unusual happens, don't shrug it off.
Next, follow the Review Policy.
Change Log
If the change is significant and affects many users, compatibility, or is a noteworthy feature, you must add a ChangeLog entry.
For more information, see: https://contribute.qt-project.org/quips/17
Additional notes
- When you commit translations, use "make commit-ts" instead of "git commit" to keep the line number information out of the committed files.
- For non-native English speakers who'd like any written English (code comments and documentation in general) to be reviewed, feel free to add one of the people listed under the Approvers and Editors section here.