Commit a89808b
committed
Add linting for trailing whitespaces, newline symbols, etc.
This PR adds configuration for `pre-commit` tool, which can run `rustfmt`
and a few other tools to ensure code style. Contrary to its name,
`pre-commit` doesn't have to be installed as a pre-commit hook.
Instead, it can be invoked manually instead of `cargo fmt`, or registered
as a pre-push hook.
I've enabled several useful checks/fixes: trailing whitespace,
trailing newlines, line encoding, validity of json/yaml/toml files,
lint that finds files broken by merge conflicts, and a few others.
I've also added settings for VSCode to fix trailing whitespaces and newlines
on file save.
# Motivation
Some contributors have their editors configured to trim trailing whitespaces
and newlines on save, while others don't. This results in spurious changes
because somebody's editor added or removed a newline at the end of file.
Hopefully this change will make them less prevalent, if at all.1 parent 0250a57 commit a89808b
File tree
3 files changed
+42
-4
lines changed- .github/workflows
- .vscode
3 files changed
+42
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments