@@ -87,27 +87,83 @@ Changes which require an RFC proposal include:
8787Maintainers have the discretion to request that contributors create an RFC for
8888PRs that are too large or complicated.
8989
90+ .. _pr_requirements :
91+
9092PR Requirements
9193***************
9294
9395- Each commit in the PR must provide a commit message following the
9496 :ref: `commit-guidelines `.
9597
98+ - No fixup or merge commits are allowed, see :ref: `Contribution workflow ` for
99+ more information.
100+
96101- The PR description must include a summary of the changes and their rationales.
97102
98103- All files in the PR must comply with :ref: `Licensing
99104 Requirements<licensing_requirements>`.
100105
101- - Follow the Zephyr :ref: `coding_style ` and :ref: `coding_guidelines `.
106+ - The code must follow the Zephyr :ref: `coding_style ` and :ref: `coding_guidelines `.
102107
103- - PRs must pass all CI checks. This is a requirement to merge the PR .
108+ - The PR must pass all CI checks, as described in :ref: ` merge_criteria ` .
104109 Contributors may mark a PR as draft and explicitly request reviewers to
105110 provide early feedback, even with failing CI checks.
106111
107- - When breaking a PR into multiple commits, each commit must build cleanly. The
112+ - When breaking up a PR into multiple commits, each commit must build cleanly. The
108113 CI system does not enforce this policy, so it is the PR author's
109114 responsibility to verify.
110115
116+ - Commits in a pull request should represent clear, logical units of change that are easy to review
117+ and maintain bisectability. The following guidelines expand on this principle:
118+
119+ 1. Distinct, Logical Units of Change
120+
121+ Each commit should correspond to a self-contained, meaningful change. For example, adding a
122+ feature, fixing a bug, or refactoring existing code should be separate commits. Avoid mixing
123+ different types of changes (e.g., feature implementation and unrelated refactoring) in the same
124+ commit.
125+
126+ 2. Retain Bisectability
127+
128+ Every commit in the pull request must build successfully and pass all relevant tests. This
129+ ensures that git bisect can be used effectively to identify the specific commit that introduced
130+ a bug or issue.
131+
132+ 3. Squash Intermediary or Non-Final Development History
133+
134+ During development, commits may include intermediary changes (e.g., partial implementations,
135+ temporary files, or debugging code). These should be squashed or rewritten before submitting the
136+ pull request. Remove non-final artifacts, such as:
137+
138+ * Temporary renaming of files that are later renamed again.
139+ * Code that was rewritten or significantly changed in later commits.
140+
141+ 4. Ensure Clean History Before Submission
142+
143+ Use interactive rebasing (git rebase -i) to clean up the commit history before submitting the
144+ pull request. This helps in:
145+
146+ * Squashing small, incomplete commits into a single cohesive commit.
147+ * Ensuring that each commit remains bisectable.
148+ * Maintaining proper attribution of authorship while improving clarity.
149+
150+ 5. Renaming and Code Rewrites
151+
152+ If files or code are renamed or rewritten in later commits during development, squash or rewrite
153+ earlier commits to reflect the final structure. This ensures that:
154+
155+ * The history remains clean and easy to follow.
156+ * Bisectability is preserved by eliminating redundant renaming or partial rewrites.
157+
158+ 6. Attribution of Authorship
159+
160+ While cleaning up the commit history, ensure that authorship attribution remains accurate.
161+
162+ 7. Readable and Reviewable History
163+
164+ The final commit history should be easy to understand for future maintainers. Logical units of
165+ change should be grouped into commits that tell a clear, coherent story of the work done.
166+
111167- When major new functionality is added, tests for the new functionality shall
112168 be added to the automated test suite. All API functions should have test cases
113169 and there should be tests for the behavior contracts of the API. Maintainers
@@ -133,6 +189,13 @@ PR Requirements
133189- Changes to APIs must increment the API version number according to the API
134190 version rules.
135191
192+ - Documentation must be added and/or updated to reflect the changes in the code
193+ introduced by the PR. The documentation changes must use the proper
194+ terminology as present in the existing pages, and must be written in American
195+ English. If you include images as part of the documentation, those must follow
196+ the rules in :ref: `doc_images `. Please refer to :ref: `doc_guidelines ` for
197+ additional information.
198+
136199- PRs must also satisfy all :ref: `merge_criteria ` before a member of the release
137200 engineering team merges the PR into the zephyr tree.
138201
0 commit comments