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
This PR unifies the linting and formatting with `pre-commit`. Before, we used a mixture of `pre-commit` and custom-installed tools. However, this could lead to version inconsistencies between different users and the CI.
**I suggest to only look at 563138b. The other commit just reformatted all the files.**
## Changed
- Switch CI to use pre-commit for linting
- Update contributing guide
- Adjust Make targets
- Formatted all files
## Fixed
- Fix missing dependency in pre-commit-config
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+14-20Lines changed: 14 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,42 +36,36 @@ Additionally, add the title and link to the pull request in the list of pull req
36
36
- Remove the link to the precompiled LLVM 12 in the `deeployRunner` for Snitch and in the CI.
37
37
[...]
38
38
```
39
-
40
39
## Style guide
41
40
42
-
Deeploy mainly consists of code implemented in C, Makefile, and Python. To facilitate efficient collaboration among users and contributors, it is important to maintain a consistent coding style. To achieve this, it is strongly recommend to use autoformatting tools with the provided configuration files. Additionally, the Continuous Integration (CI) system checks the adherence to the style guide for each pushed commit. Currently configuration for C using `clang-format` and for Python using `yapf` and `isort` are provided.
43
-
44
-
You can format all relevant files by running:
45
-
```bash
46
-
make format
47
-
```
48
-
49
-
Alternatively, to only lint the files without modifying them, you can run:
50
-
```bash
51
-
make lint
52
-
```
53
-
54
-
### Pre-commit
41
+
Deeploy mainly consists of code implemented in C, Makefile, and Python. To facilitate efficient collaboration among users and contributors, it is important to maintain a consistent coding style. We use [pre-commit](https://pre-commit.com) with autoformatting tools to maintain this consistency. Configuration is provided for C using `clang-format` and for Python using `yapf` and `isort`.
55
42
56
-
Additionally, we provide the [pre-commit](https://pre-commit.com) configuration file which you can use to install github hooks that execute the formatting commands on your changes.
43
+
### Setting up pre-commit
57
44
58
-
You will need to manually install pre-commit since it's not added as a dependency to the `pyproject.toml`:
45
+
Install pre-commit (not included in `pyproject.toml`):
59
46
```bash
60
47
pip install pre-commit
61
48
```
62
49
63
-
The configuration sets the default stage for all the hooks to `pre-push`so to install the git hooks run:
50
+
Install the git hooks configured to run at the `pre-push`stage:
64
51
```bash
65
52
pre-commit install --hook-type pre-push
66
53
```
67
-
The hooks will run before each push, making sure the pushed code can pass linting checks and not fail the CI on linting.
68
54
69
-
If you change your mind and don't want the git hooks:
55
+
The hooks will automatically format your code before each push, ensuring it passes linting checks and CI validation.
56
+
57
+
To uninstall the git hooks:
70
58
```bash
71
59
pre-commit uninstall
72
60
```
73
61
74
-
_Note:_ This configures only the python formatting git hooks. The c formatting is not supported at the moment.
62
+
You can also manually run formatting without pushing:
0 commit comments