1- # Contributing to matrix-rust-sdk
1+ # Contributing to ` matrix-rust-sdk `
22
33## Chat rooms
44
@@ -29,50 +29,55 @@ integration tests that need a running synapse instance. These tests reside in
2929[ README] ( ./testing/matrix-sdk-integration-testing/README.md ) to easily set up a
3030synapse for testing purposes.
3131
32-
3332### Snapshot Testing
3433
3534You can add/review snapshot tests using [ insta.rs] ( https://insta.rs )
3635
37- Every new struct/enum that derives ` Serialize ` ` Deserialise ` should have a snapshot test for it.
38- Any code change that breaks serialisation will then break a test, the author will then have to decide
39- how to handle migration and test it if needed.
40-
36+ Every new struct/enum that derives ` Serialize ` ` Deserialise ` should have a
37+ snapshot test for it. Any code change that breaks serialisation will then break
38+ a test, the author will then have to decide how to handle migration and test it
39+ if needed.
4140
42- And for an improved review experience it's recommended (but not necessary) to install the cargo-insta tool:
41+ And for an improved review experience it's recommended (but not necessary) to
42+ install the ` cargo-insta ` tool:
4343
4444Unix:
45- ```
45+
46+ ``` shell
4647curl -LsSf https://insta.rs/install.sh | sh
4748```
4849
4950Windows:
50- ```
51+
52+ ``` shell
5153powershell -c " irm https://insta.rs/install.ps1 | iex"
5254```
5355
5456Usual flow is to first run the test, then review them.
55- ```
57+
58+ ``` shell
5659cargo insta test
5760cargo insta review
5861```
5962
6063### Intermittent failure policy
6164
62- While we strive to add test coverage for as many features as we can, it sometimes happens that the
63- tests will be intermittently failing in CI (such tests are sometimes called "flaky"). This can be
64- caused by race conditions of all sorts, either in the test code itself, but sometimes in the
65- underlying feature being tested too, and as such, it requires some investigation, usually from the
66- original author of the test.
65+ While we strive to add test coverage for as many features as we can, it
66+ sometimes happens that the tests will be intermittently failing in CI (such
67+ tests are sometimes called "flaky"). This can be caused by race conditions
68+ of all sorts, either in the test code itself, but sometimes in the underlying
69+ feature being tested too, and as such, it requires some investigation, usually
70+ from the original author of the test.
6771
68- Whenever such an intermittent failure happens, we try to open an issue to track the failures,
69- adding the
72+ Whenever such an intermittent failure happens, we try to open an issue to track
73+ the failures, adding the
7074[ ` intermittent-failure ` ] ( https://github.com/matrix-org/matrix-rust-sdk/issues?q=is%3Aissue%20state%3Aopen%20label%3Aintermittent-failure )
7175label to it, and commenting with links to CI runs where the failure happened.
7276
73- If a test has been intermittently failing for ** two weeks** or more, and no one is actively working
74- on fixing it, then we might decide to mark the test as ` ignored ` until it is fixed, to not cause
75- unrelated failures in other contributors' pull requests and pushes.
77+ If a test has been intermittently failing for ** two weeks** or more, and no one
78+ is actively working on fixing it, then we might decide to mark the test as
79+ ` ignored ` until it is fixed, to not cause unrelated failures in other
80+ contributors' pull requests and pushes.
7681
7782## Pull requests
7883
@@ -87,7 +92,7 @@ be a good PR title.
8792(An additional bad example of a bad PR title would be ` mynickname/branch name ` ,
8893that is, just the branch name.)
8994
90- # Writing changelog entries
95+ ## Writing changelog entries
9196
9297Our goal is to maintain clear, concise, and informative changelogs that
9398accurately document changes in the project. Changelog entries should be written
@@ -122,12 +127,17 @@ For security-related changelog entries, please include the following additional
122127details alongside the pull request number:
123128
124129* Impact: Clearly describe the issue's potential impact on users or systems.
125- * CVE Number: If available, include the CVE (Common Vulnerabilities and Exposures) identifier.
126- * GitHub Advisory Link: Provide a link to the corresponding GitHub security advisory for further context.
130+ * CVE Number: If available, include the CVE (Common Vulnerabilities and
131+ Exposures) identifier.
132+ * GitHub Advisory Link: Provide a link to the corresponding GitHub security
133+ advisory for further context.
127134
128135``` markdown
129136- Use a constant-time Base64 encoder for secret key material to mitigate
130- side-channel attacks leaking secret key material ([#156](https://github.com/matrix-org/vodozemac/pull/156)) (Low, [CVE-2024-40640](https://www.cve.org/CVERecord?id=CVE-2024-40640), [GHSA-j8cm-g7r6-hfpq](https://github.com/matrix-org/vodozemac/security/advisories/GHSA-j8cm-g7r6-hfpq)).
137+ side-channel attacks leaking secret key material
138+ ([#156](https://github.com/matrix-org/vodozemac/pull/156)) (Low,
139+ [CVE-2024-40640](https://www.cve.org/CVERecord?id=CVE-2024-40640),
140+ [GHSA-j8cm-g7r6-hfpq](https://github.com/matrix-org/vodozemac/security/advisories/GHSA-j8cm-g7r6-hfpq)).
131141```
132142
133143## Commit message format
@@ -139,14 +149,15 @@ git trailers are supported and have special meaning (see below).
139149
140150Conventional Commits are structured as follows:
141151
142- ```
152+ ``` text
143153<type>(<scope>): <short summary>
144154```
145155
146- The type of changes which will be included in changelogs is one of the following:
156+ The type of changes which will be included in changelogs is one of the
157+ following:
147158
148159* ` feat ` : A new feature
149- * ` fix ` : A bug fix
160+ * ` fix ` : A bugfix
150161* ` doc ` : Documentation changes
151162* ` refactor ` : Code refactoring
152163* ` perf ` : Performance improvements
@@ -163,15 +174,16 @@ changelog entry.
163174
164175The metadata must be included in the following git-trailers:
165176
166- * ` Security-Impact ` : The magnitude of harm that can be expected, i.e. low/moderate/high/critical.
177+ * ` Security-Impact ` : The magnitude of harm that can be expected, i.e.
178+ low/moderate/high/critical.
167179* ` CVE ` : The CVE that was assigned to this issue.
168180* ` GitHub-Advisory ` : The GitHub advisory identifier.
169181
170- Please include all of the fields that are available.
182+ Please include all the fields that are available.
171183
172184Example:
173185
174- ```
186+ ``` text
175187fix(crypto): Use a constant-time Base64 encoder for secret key material
176188
177189This patch fixes a security issue around a side-channel vulnerability[1]
@@ -213,9 +225,9 @@ your contributions, follow these basic rules:
213225
2142265 . Keep PRs on topic and small. Large PRs are harder to review and more prone to
215227 delays. Create small, focused commits that address a single topic. Use a
216- combination of [ git add] -p or git checkout -p to split changes into logical
217- units. This makes your work easier to review and reduces the chance of
218- introducing unrelated changes.
228+ combination of [ git add] -p or [ git checkout] -p to split changes into
229+ logical units. This makes your work easier to review and reduces the chance
230+ of introducing unrelated changes.
219231
220232[ git add ] : https://git-scm.com/docs/git-add#Documentation/git-add.txt---patch
221233[ git checkout ] : https://git-scm.com/docs/git-checkout#Documentation/git-checkout.txt---patch
@@ -227,12 +239,12 @@ guidelines to make the maintainers life easier and increase the chances that
227239your PR will be reviewed swiftly.
228240
2292411 . Use [ fixup] commits. When addressing reviewer feedback, you can create fixup
230- commits. These commits mark your changes as corrections of specific previous
231- commits in the PR.
242+ commits. These commits mark your changes as corrections of specific previous
243+ commits in the PR.
232244
233245Example:
234246
235- ``` bash
247+ ``` shell
236248git commit --fixup=< commit-hash>
237249```
238250
@@ -247,7 +259,7 @@ requested.
2472593 . Once the PR has been approved, rebase your PR to squash all the fixup
248260 commits, the [ autosquash] option can help with this.
249261
250- ``` bash
262+ ``` shell
251263git rebase main --interactive --autosquash
252264```
253265
@@ -257,14 +269,16 @@ git rebase main --interactive --autosquash
257269## Sign off
258270
259271In order to have a concrete record that your contribution is intentional
260- and you agree to license it under the same terms as the project's license, we've
261- adopted the same lightweight approach that the [ Linux Kernel] ( https://www.kernel.org/doc/Documentation/SubmittingPatches ) ,
262- [ Docker] ( https://github.com/docker/docker/blob/master/CONTRIBUTING.md ) , and many other
263- projects use: the DCO ([ Developer Certificate of Origin] ( http://developercertificate.org/ ) ).
264- This is a simple declaration that you wrote the contribution or otherwise have the right
265- to contribute it to Matrix:
266-
267- ```
272+ and you agree to license it under the same terms as the project's
273+ license, we've adopted the same lightweight approach that the [ Linux
274+ Kernel] ( https://www.kernel.org/doc/Documentation/SubmittingPatches ) ,
275+ [ Docker] ( https://github.com/docker/docker/blob/master/CONTRIBUTING.md ) ,
276+ and many other projects use: the DCO ([ Developer Certificate of
277+ Origin] ( http://developercertificate.org/ ) ). This is a simple declaration that
278+ you wrote the contribution or otherwise have the right to contribute it to
279+ Matrix:
280+
281+ ``` text
268282Developer Certificate of Origin
269283Version 1.1
270284
@@ -305,7 +319,7 @@ By making a contribution to this project, I certify that:
305319If you agree to this for your contribution, then all that's needed is to
306320include the line in your commit or pull request comment:
307321
308- ```
322+ ``` text
309323Signed-off-by: Your Name <[email protected] > 310324```
311325
@@ -316,15 +330,15 @@ Git allows you to add this signoff automatically when using the `-s` flag to
316330If you forgot to sign off your commits before making your pull request and are
317331on Git 2.17+ you can mass signoff using rebase:
318332
319- ```
333+ ``` text
320334git rebase --signoff origin/main
321335```
322336
323337## Tips for working on the ` matrix-rust-sdk ` with specific IDEs
324338
325339* [ RustRover] ( https://www.jetbrains.com/rust/ ) will attempt to sync the project
326340 with all features enabled, causing an error in ` matrix-sdk ` ("only one of the
327- features ' native-tls' or ' rustls-tls' can be enabled"). To work around this,
341+ features ` native-tls ` or ` rustls-tls ` can be enabled"). To work around this,
328342 open ` crates/matrix-sdk/Cargo.toml ` in RustRover and uncheck one of the
329343 ` native-tls ` or ` rustls-tls ` feature definitions:
330344
0 commit comments