|
| 1 | +Pull Request Review Caveats |
| 2 | +=========================== |
| 3 | + |
| 4 | +.. _repository settings: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#preventing-github-actions-from-creating-or-approving-pull-requests |
| 5 | +.. _organization settings: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#preventing-github-actions-from-creating-or-approving-pull-requests |
| 6 | +.. _hiding a comment: https://docs.github.com/en/communities/moderating-comments-and-conversations/managing-disruptive-comments#hiding-a-comment |
| 7 | +.. _resolve a conversion: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/commenting-on-a-pull-request#resolving-conversations |
| 8 | + |
| 9 | +.. hint:: |
| 10 | + |
| 11 | + This information is specific to GitHub Pull Requests (often abbreviated as "PR"). |
| 12 | + |
| 13 | +While the Pull Request review feature has been thoroughly tested, there are still some caveats to |
| 14 | +beware of when using Pull Request reviews. |
| 15 | + |
| 16 | +1. The "GitHub Actions" bot may need to be allowed to approve Pull Requests. |
| 17 | + By default, the bot cannot approve Pull Request changes, only request more changes. |
| 18 | + This will show as a warning in the workflow logs if the given token (set to the |
| 19 | + environment variable ``GITHUB_TOKEN``) isn't configured with the proper permissions. |
| 20 | + |
| 21 | + .. seealso:: |
| 22 | + |
| 23 | + Refer to the GitHub documentation for `repository settings`_ or `organization settings`_ |
| 24 | + about adjusting the required permissions for GitHub Actions's ``secrets.GITHUB_TOKEN``. |
| 25 | +2. The feature is auto-disabled for |
| 26 | + |
| 27 | + - closed Pull Requests |
| 28 | + - Pull Requests marked as "draft" |
| 29 | + - push events |
| 30 | +3. Clang-tidy and clang-format suggestions are shown in 1 Pull Request review. |
| 31 | + |
| 32 | + - Users are encouraged to choose either :std:option:`--tidy-review` or :std:option:`--format-review`. |
| 33 | + Enabling both will likely show duplicate or similar suggestions. |
| 34 | + Remember, clang-tidy can be configured to use the same ``style`` that clang-format accepts. |
| 35 | + There is no current implementation to combine suggestions from both tools (clang-tidy kind of |
| 36 | + does that anyway). |
| 37 | + - Each generated review is specific to the commit that triggered the Continuous Integration |
| 38 | + workflow. |
| 39 | + - Outdated reviews are dismissed but not marked as resolved. |
| 40 | + Also, the outdated review's summary comment is not automatically hidden. |
| 41 | + To reduce the Pull Request's thread noise, users interaction is required. |
| 42 | + |
| 43 | + .. seealso:: |
| 44 | + |
| 45 | + Refer to GitHub's documentation about `hiding a comment`_. |
| 46 | + Hiding a Pull Request review's summary comment will not resolve the suggestions in the diff. |
| 47 | + Please also refer to `resolve a conversion`_ to collapse outdated or duplicate suggestions |
| 48 | + in the diff. |
| 49 | + |
| 50 | + GitHub REST API does not provide a way to hide comments or mark review suggestions as resolved. |
| 51 | + |
| 52 | + .. tip:: |
| 53 | + |
| 54 | + We do support an environment variable named ``CPP_LINTER_PR_REVIEW_SUMMARY_ONLY``. |
| 55 | + If the variable is set to ``true``, then the review only contains a summary comment |
| 56 | + with no suggestions posted in the diff. |
| 57 | +4. If any suggestions did not fit within the Pull Request diff, then the review's summary comment will |
| 58 | + indicate how many suggestions were left out. |
| 59 | + The full patch of suggestions is always included as a collapsed code block in the review summary |
| 60 | + comment. This isn't a problem we can fix. |
| 61 | + GitHub won't allow review comments/suggestions to target lines that are not shown in the Pull |
| 62 | + Request diff (the summation of file differences in a Pull Request). |
| 63 | + |
| 64 | + - Users are encouraged to set :std:option:`--lines-changed-only` to ``true``. |
| 65 | + This will *help* us keep the suggestions limited to lines that are shown within the Pull |
| 66 | + Request diff. |
| 67 | + However, there are still some cases where clang-format or clang-tidy will apply fixes to lines |
| 68 | + that are not within the diff. |
| 69 | + This can't be avoided because the ``--line-filter`` passed to the clang-tidy (and ``--lines`` |
| 70 | + passed to clang-format) only applies to analysis, not fixes. |
| 71 | + - Not every diagnostic from clang-tidy can be automatically fixed. |
| 72 | + Some diagnostics require user interaction/decision to properly address. |
| 73 | + - Some fixes provided might depend on what compiler is used. |
| 74 | + We have made it so clang-tidy takes advantage of any fixes provided by the compiler. |
| 75 | + Compilation errors may still prevent clang-tidy from reporting all concerns. |
0 commit comments