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: development.md
+16-13Lines changed: 16 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,48 +134,51 @@ One way to do it could be to add each environment variable to your CI/CD system,
134
134
135
135
## Pre-commits and code linting
136
136
137
-
we are using a tool called [pre-commit](https://pre-commit.com/) for code linting and formatting.
137
+
we are using a tool called [prek](https://prek.j178.dev/) (modern alternative to [Pre-commit](https://pre-commit.com/)) for code linting and formatting.
138
138
139
139
When you install it, it runs right before making a commit in git. This way it ensures that the code is consistent and formatted even before it is committed.
140
140
141
141
You can find a file `.pre-commit-config.yaml` with configurations at the root of the project.
142
142
143
-
#### Install pre-commit to run automatically
143
+
#### Install prek to run automatically
144
144
145
-
`pre-commit` is already part of the dependencies of the project, but you could also install it globally if you prefer to, following [the official pre-commit docs](https://pre-commit.com/).
145
+
`prek` is already part of the dependencies of the project.
146
146
147
-
After having the `pre-commit` tool installed and available, you need to "install" it in the local repository, so that it runs automatically before each commit.
147
+
After having the `prek` tool installed and available, you need to "install" it in the local repository, so that it runs automatically before each commit.
148
148
149
-
Using `uv`, you could do it with:
149
+
Using `uv`, you could do it with (make sure you are inside `backend` folder):
150
150
151
151
```bash
152
-
❯ uv run pre-commit install
153
-
pre-commit installed at .git/hooks/pre-commit
152
+
❯ uv run prek install -f
153
+
prek installed at `../.git/hooks/pre-commit`
154
154
```
155
155
156
+
The `-f` flag forces the installation, in case there was already a `pre-commit` hook previously installed.
157
+
156
158
Now whenever you try to commit, e.g. with:
157
159
158
160
```bash
159
161
git commit
160
162
```
161
163
162
-
...pre-commit will run and check and format the code you are about to commit, and will ask you to add that code (stage it) with git again before committing.
164
+
...prek will run and check and format the code you are about to commit, and will ask you to add that code (stage it) with git again before committing.
163
165
164
166
Then you can `git add` the modified/fixed files again and now you can commit.
165
167
166
-
#### Running pre-commit hooks manually
168
+
#### Running prek hooks manually
167
169
168
-
you can also run `pre-commit` manually on all the files, you can do it using `uv` with:
170
+
you can also run `prek` manually on all the files, you can do it using `uv` with:
169
171
170
172
```bash
171
-
❯ uv run pre-commit run --all-files
173
+
❯ uv run prek run --all-files
172
174
check for added large files..............................................Passed
0 commit comments