|
| 1 | +# Review Guidelines |
| 2 | + |
| 3 | +The following summarises review guidelines that we follow for pull requests in |
| 4 | +Riot Web and other supporting repos. These are just guidelines (not strict |
| 5 | +rules) and may be updated over time. |
| 6 | + |
| 7 | +## Code Review |
| 8 | + |
| 9 | +When reviewing code, here are some things we look for and also things we avoid: |
| 10 | + |
| 11 | +### We review for |
| 12 | + |
| 13 | +* Correctness |
| 14 | +* Performance |
| 15 | +* Accessibility |
| 16 | +* Security |
| 17 | +* Comments and documentation where needed |
| 18 | +* Sharing knowledge of different areas among the team |
| 19 | +* Ensuring it's something we're comfortable maintaining for the long term |
| 20 | +* Progress indicators and local echo where appropriate with network activity |
| 21 | + |
| 22 | +### We should avoid |
| 23 | + |
| 24 | +* Style nits that are already handled by the linter |
| 25 | +* Dramatically increasing scope |
| 26 | + |
| 27 | +### Good practices |
| 28 | + |
| 29 | +* Use empathetic language |
| 30 | + * See also [Mindful Communication in Code |
| 31 | + Reviews](https://kickstarter.engineering/a-guide-to-mindful-communication-in-code-reviews-48aab5282e5e) |
| 32 | + and [How to Do Code Reviews Like a Human](https://mtlynch.io/human-code-reviews-1/) |
| 33 | +* Authors should prefer smaller commits for easier reviewing and bisection |
| 34 | +* Reviewers should be explicit about required versus optional changes |
| 35 | + * Reviews are conversations and the PR author should feel comfortable |
| 36 | + discussing and pushing back on changes before making them |
| 37 | +* Core team should lead by example through their tone and language |
| 38 | +* Take the time to thank and point out good code changes |
| 39 | +* Using softer language like "please" and "what do you think?" goes a long way |
| 40 | + towards making others feel like colleagues working towards a common goal |
| 41 | + |
| 42 | +### Workflow |
| 43 | + |
| 44 | +* Authors should request review from riot-web team by default (if someone on the |
| 45 | + team is clearly the expert in an area, a direct review request to them may be |
| 46 | + more appropriate) |
| 47 | +* Reviewers should remove the team review request and request review from |
| 48 | + themselves when starting a review to avoid double review |
| 49 | +* Authors should link to other layers of their PR in their PR before requesting |
| 50 | + review. Reviewers might be coming from different places and could miss other |
| 51 | + required PRs. |
| 52 | +* Avoid force pushing to a PR after first round of review |
| 53 | +* Use the GitHub default of merge commits when landing (avoid alternate options |
| 54 | + like squash or rebase) |
| 55 | +* PR author merges after review (assuming they have write access) |
| 56 | +* Assign issues only when in progress to indicate to others what can be picked |
| 57 | + up |
| 58 | + |
| 59 | +## Design and Product Review |
| 60 | + |
| 61 | +We want to ensure that all changes to Riot fit with our design and product |
| 62 | +vision. We often request review from those teams so they can provide their |
| 63 | +perspective. |
| 64 | + |
| 65 | +In more detail, our usual process for changes that affect the UI or alter user |
| 66 | +functionality is: |
| 67 | + |
| 68 | +* For changes that will go live when merged, always flag Design and Product |
| 69 | + teams as appropriate |
| 70 | +* For changes guarded by a feature flag, Design and Product review is not |
| 71 | + required (though may still be useful) since we can continue tweaking |
| 72 | + |
| 73 | +As it can be difficult to review design work from looking at just the changed |
| 74 | +files in a PR, authors should be prepared for Design and / or Product teams to |
| 75 | +request a link to an ad-hoc build of Riot (hosted anywhere) that can be used for |
| 76 | +the review. In the future, we [hope to automate |
| 77 | +this](https://github.com/vector-im/riot-web/issues/12624) for every PR. |
| 78 | + |
| 79 | +Before starting work on a feature, it's best to ensure your plan aligns well |
| 80 | +with our vision for Riot. Please chat with the team in |
| 81 | +[#riot-dev:matrix.org](https://matrix.to/#/#riot-dev:matrix.org) before you |
| 82 | +start so we can ensure it's something we'd be willing to merge. |
0 commit comments