You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,7 @@ These checks will:
110
110
* Lint GitHub Actions workflow files using actionlint *
111
111
* Lint Dockerfiles using hadolint *
112
112
113
-
(* these checks will not change the edited files, you must manually fix the files or run an automated tool eg: `ruff check --fix`)
113
+
(* these checks will not change the edited files, you must manually fix the files or run an automated tool eg: `ruff check --fix` see below for details)
114
114
115
115
If you absolutely must push "dirty" code, `pre-commit` can be circumvented using:
116
116
```bash
@@ -133,6 +133,23 @@ Some coding rules are "enforced" (and automatically checked by CI), some are "st
133
133
- Comment your code, and do not be afraid of being verbose. The first letter must be capitalized. Do not use punctuation (unless the comment consists of multiple sentences).
134
134
* We _like_ that blank lines are used to logically split blocks of code implementing different (possibly sequential) tasks.
135
135
136
+
#### Pre-commit
137
+
138
+
You can use `pre-commit` to apply automated fixes for line endings, ends of files, import sorting and ruff linting.
139
+
All of these steps can be run together on your changes by running:
140
+
```bash
141
+
pre-commit run --hook-stage manual
142
+
```
143
+
Adding the `-a` flag runs this on all files in the repository, not just the files that you have changed.
144
+
Adding the name of the stage will run just one check.
145
+
See the [pre-commit-config](https://github.com/devitocodes/devito/blob/main/.pre-commit.yaml) file for the names of stages.
146
+
147
+
Some fixes can be automatically applied by the ruff linter, but may change the code in undesirable ways.
148
+
This step can only be run manually:
149
+
```bash
150
+
ruff check --fix --unsafe-fixes
151
+
```
152
+
136
153
### Adding tutorials or examples
137
154
138
155
We always look forward to extending our [suite of tutorials and examples](https://www.devitoproject.org/devito/tutorials.html) with new Jupyter Notebooks.
0 commit comments