@@ -13,44 +13,44 @@ anything, feel free to ask questions on issues or visit the `#clippy` on [Zulip]
13
13
All contributors are expected to follow the [ Rust Code of Conduct] .
14
14
15
15
- [ Contributing to Clippy] ( #contributing-to-clippy )
16
- - [ Getting started ] ( #getting-started )
17
- - [ High level approach] ( #high-level-approach )
18
- - [ Finding something to fix/improve] ( #finding-something-to-fiximprove )
16
+ - [ The Clippy book ] ( #the-clippy-book )
17
+ - [ High level approach] ( #high-level-approach )
18
+ - [ Finding something to fix/improve] ( #finding-something-to-fiximprove )
19
19
- [ Writing code] ( #writing-code )
20
20
- [ Getting code-completion for rustc internals to work] ( #getting-code-completion-for-rustc-internals-to-work )
21
21
- [ IntelliJ Rust] ( #intellij-rust )
22
22
- [ Rust Analyzer] ( #rust-analyzer )
23
23
- [ How Clippy works] ( #how-clippy-works )
24
- - [ Syncing changes between Clippy and ` rust-lang/rust ` ] ( #syncing-changes-between-clippy-and-rust-langrust )
25
- - [ Patching git-subtree to work with big repos] ( #patching-git-subtree-to-work-with-big-repos )
26
- - [ Performing the sync from ` rust-lang/rust ` to Clippy] ( #performing-the-sync-from-rust-langrust-to-clippy )
27
- - [ Performing the sync from Clippy to ` rust-lang/rust ` ] ( #performing-the-sync-from-clippy-to-rust-langrust )
28
- - [ Defining remotes] ( #defining-remotes )
29
24
- [ Issue and PR triage] ( #issue-and-pr-triage )
30
25
- [ Bors and Homu] ( #bors-and-homu )
31
26
- [ Contributions] ( #contributions )
32
27
33
28
[ Zulip ] : https://rust-lang.zulipchat.com/#narrow/stream/clippy
34
29
[ Rust Code of Conduct ] : https://www.rust-lang.org/policies/code-of-conduct
35
30
36
- ## Getting started
31
+ ## The Clippy book
37
32
38
- ** Note: If this is your first time contributing to Clippy, you should
39
- first read the [ Basics docs ] ( doc/basics.md ) . **
33
+ If you're new to Clippy and don't know where to start the [ Clippy book ] includes
34
+ a developer guide and is a good place to start your journey.
40
35
41
- ### High level approach
36
+ <!-- FIXME: Link to the deployed book, once it is deployed through CI -->
37
+ [ Clippy book ] : book/src
38
+
39
+ ## High level approach
42
40
43
41
1 . Find something to fix/improve
44
42
2 . Change code (likely some file in ` clippy_lints/src/ ` )
45
- 3 . Follow the instructions in the [ Basics docs] ( doc/basics.md ) to get set up
43
+ 3 . Follow the instructions in the [ Basics docs] ( book/src/development/basics.md )
44
+ to get set up
46
45
4 . Run ` cargo test ` in the root directory and wiggle code until it passes
47
46
5 . Open a PR (also can be done after 2. if you run into problems)
48
47
49
- ### Finding something to fix/improve
48
+ ## Finding something to fix/improve
50
49
51
- All issues on Clippy are mentored, if you want help simply ask @Manishearth , @flip1995 , @phansch
52
- or @llogiq directly by mentioning them in the issue or over on [ Zulip] . This list may be out of date.
53
- All currently active mentors can be found [ here] ( https://github.com/rust-lang/highfive/blob/master/highfive/configs/rust-lang/rust-clippy.json#L3 )
50
+ All issues on Clippy are mentored, if you want help simply ask someone from the
51
+ Clippy team directly by mentioning them in the issue or over on [ Zulip] . All
52
+ currently active team members can be found
53
+ [ here] ( https://github.com/rust-lang/highfive/blob/master/highfive/configs/rust-lang/rust-clippy.json#L3 )
54
54
55
55
Some issues are easier than others. The [ ` good-first-issue ` ] label can be used to find the easy
56
56
issues. You can use ` @rustbot claim ` to assign the issue to yourself.
@@ -91,20 +91,6 @@ an AST expression). `match_def_path()` in Clippy's `utils` module can also be us
91
91
[ let chains ] : https://github.com/rust-lang/rust/pull/94927
92
92
[ nest-less ] : https://github.com/rust-lang/rust-clippy/blob/5e4f0922911536f80d9591180fa604229ac13939/clippy_lints/src/bit_mask.rs#L133-L159
93
93
94
- ## Writing code
95
-
96
- Have a look at the [ docs for writing lints] [ adding_lints ] for more details.
97
-
98
- If you want to add a new lint or change existing ones apart from bugfixing, it's
99
- also a good idea to give the [ stability guarantees] [ rfc_stability ] and
100
- [ lint categories] [ rfc_lint_cats ] sections of the [ Clippy 1.0 RFC] [ clippy_rfc ] a
101
- quick read.
102
-
103
- [ adding_lints ] : https://github.com/rust-lang/rust-clippy/blob/master/doc/adding_lints.md
104
- [ clippy_rfc ] : https://github.com/rust-lang/rfcs/blob/master/text/2476-clippy-uno.md
105
- [ rfc_stability ] : https://github.com/rust-lang/rfcs/blob/master/text/2476-clippy-uno.md#stability-guarantees
106
- [ rfc_lint_cats ] : https://github.com/rust-lang/rfcs/blob/master/text/2476-clippy-uno.md#lint-audit-and-categories
107
-
108
94
## Getting code-completion for rustc internals to work
109
95
110
96
### IntelliJ Rust
@@ -205,126 +191,6 @@ That's why the `else_if_without_else` example uses the `register_early_pass` fun
205
191
[ early_lint_pass ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/trait.EarlyLintPass.html
206
192
[ late_lint_pass ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint/trait.LateLintPass.html
207
193
208
- ## Syncing changes between Clippy and [ ` rust-lang/rust ` ]
209
-
210
- Clippy currently gets built with a pinned nightly version.
211
-
212
- In the ` rust-lang/rust ` repository, where rustc resides, there's a copy of Clippy
213
- that compiler hackers modify from time to time to adapt to changes in the unstable
214
- API of the compiler.
215
-
216
- We need to sync these changes back to this repository periodically, and the changes
217
- made to this repository in the meantime also need to be synced to the ` rust-lang/rust ` repository.
218
-
219
- To avoid flooding the ` rust-lang/rust ` PR queue, this two-way sync process is done
220
- in a bi-weekly basis if there's no urgent changes. This is done starting on the day of
221
- the Rust stable release and then every other week. That way we guarantee that we keep
222
- this repo up to date with the latest compiler API, and every feature in Clippy is available
223
- for 2 weeks in nightly, before it can get to beta. For reference, the first sync
224
- following this cadence was performed the 2020-08-27.
225
-
226
- This process is described in detail in the following sections. For general information
227
- about ` subtree ` s in the Rust repository see [ Rust's ` CONTRIBUTING.md ` ] [ subtree ] .
228
-
229
- ### Patching git-subtree to work with big repos
230
-
231
- Currently, there's a bug in ` git-subtree ` that prevents it from working properly
232
- with the [ ` rust-lang/rust ` ] repo. There's an open PR to fix that, but it's stale.
233
- Before continuing with the following steps, we need to manually apply that fix to
234
- our local copy of ` git-subtree ` .
235
-
236
- You can get the patched version of ` git-subtree ` from [ here] [ gitgitgadget-pr ] .
237
- Put this file under ` /usr/lib/git-core ` (taking a backup of the previous file)
238
- and make sure it has the proper permissions:
239
-
240
- ``` bash
241
- sudo cp --backup /path/to/patched/git-subtree.sh /usr/lib/git-core/git-subtree
242
- sudo chmod --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subtree
243
- sudo chown --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subtree
244
- ```
245
-
246
- _ Note:_ The first time running ` git subtree push ` a cache has to be built. This
247
- involves going through the complete Clippy history once. For this you have to
248
- increase the stack limit though, which you can do with ` ulimit -s 60000 ` .
249
- Make sure to run the ` ulimit ` command from the same session you call git subtree.
250
-
251
- _ Note:_ If you are a Debian user, ` dash ` is the shell used by default for scripts instead of ` sh ` .
252
- This shell has a hardcoded recursion limit set to 1000. In order to make this process work,
253
- you need to force the script to run ` bash ` instead. You can do this by editing the first
254
- line of the ` git-subtree ` script and changing ` sh ` to ` bash ` .
255
-
256
- ### Performing the sync from [ ` rust-lang/rust ` ] to Clippy
257
-
258
- Here is a TL;DR version of the sync process (all of the following commands have
259
- to be run inside the ` rust ` directory):
260
-
261
- 1 . Clone the [ ` rust-lang/rust ` ] repository or make sure it is up to date.
262
- 2 . Checkout the commit from the latest available nightly. You can get it using ` rustup check ` .
263
- 3 . Sync the changes to the rust-copy of Clippy to your Clippy fork:
264
- ``` bash
265
- # Make sure to change `your-github-name` to your github name in the following command. Also be
266
- # sure to either use a net-new branch, e.g. `sync-from-rust`, or delete the branch beforehand
267
- # because changes cannot be fast forwarded
268
- git subtree push -P src/tools/clippy
[email protected] :your-github-name/rust-clippy sync-from-rust
269
- ```
270
-
271
- _Note:_ This will directly push to the remote repository. You can also push
272
- to your local copy by replacing the remote address with ` /path/to/rust-clippy`
273
- directory.
274
-
275
- _Note:_ Most of the time you have to create a merge commit in the
276
- ` rust-clippy` repo (this has to be done in the Clippy repo, not in the
277
- rust-copy of Clippy):
278
- ` ` ` bash
279
- git fetch origin && git fetch upstream
280
- git checkout sync-from-rust
281
- git merge upstream/master
282
- ` ` `
283
- 4. Open a PR to ` rust-lang/rust-clippy` and wait for it to get merged (to
284
- accelerate the process ping the ` @rust-lang/clippy` team in your PR and/or
285
- ~ ~annoy~~ ask them in the [Zulip] stream.)
286
-
287
- # ## Performing the sync from Clippy to [`rust-lang/rust`]
288
-
289
- All of the following commands have to be run inside the ` rust` directory.
290
-
291
- 1. Make sure Clippy itself is up-to-date by following the steps outlined in the previous
292
- section if necessary.
293
-
294
- 2. Sync the ` rust-lang/rust-clippy` master to the rust-copy of Clippy:
295
- ` ` ` bash
296
- git checkout -b sync-from-clippy
297
- git subtree pull -P src/tools/clippy https://github.com/rust-lang/rust-clippy master
298
- ` ` `
299
- 3. Open a PR to [` rust-lang/rust` ]
300
-
301
- # ## Defining remotes
302
-
303
- You may want to define remotes, so you don' t have to type out the remote
304
- addresses on every sync. You can do this with the following commands (these
305
- commands still have to be run inside the `rust` directory):
306
-
307
- ```bash
308
- # Set clippy-upstream remote for pulls
309
- $ git remote add clippy-upstream https://github.com/rust-lang/rust-clippy
310
- # Make sure to not push to the upstream repo
311
- $ git remote set-url --push clippy-upstream DISABLED
312
- # Set clippy-origin remote to your fork for pushes
313
- $ git remote add clippy-origin [email protected] :your-github-name/rust-clippy
314
- # Set a local remote
315
- $ git remote add clippy-local /path/to/rust-clippy
316
- ```
317
-
318
- You can then sync with the remote names from above, e.g.:
319
-
320
- ```bash
321
- $ git subtree push -P src/tools/clippy clippy-local sync-from-rust
322
- ```
323
-
324
- [gitgitgadget-pr]: https://github.com/gitgitgadget/git/pull/493
325
- [subtree]: https://rustc-dev-guide.rust-lang.org/contributing.html#external-dependencies-subtree
326
- [`rust-lang/rust`]: https://github.com/rust-lang/rust
327
-
328
194
## Issue and PR triage
329
195
330
196
Clippy is following the [ Rust triage procedure] [ triage ] for issues and pull
0 commit comments