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: README.md
+11-13Lines changed: 11 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,12 +142,22 @@ Steps:
142
142
pip install poetry
143
143
```
144
144
145
-
8. Install pre-commit hooks. Ensure you have installed nodejs at the same version or later as per .tool-versions and
145
+
### Install Pre-Commit Hooks
146
+
147
+
[Husky](https://typicode.github.io/husky/) is used to perform automatic checks upon making a commit.
148
+
It is configured within `.husky/pre-commit` to run the checks defined in the root level `package.json` under `lint-staged`.
149
+
To set this up:
150
+
151
+
1. Ensure you have installed nodejs at the same version or later as per .tool-versions and
146
152
then, from the repo root, run:
153
+
147
154
```
148
155
npm install
149
156
```
150
157
158
+
2. Run `cd quality_checks` then `poetry install --no-root`. This will make sure your version of ruff is the same as used in the GitHub pipeline.
159
+
You can check your version is correct by running `poetry run ruff --version` from within the `quality_checks` directory and comparing to the version in the poetry.lock file.
160
+
151
161
### Setting up a virtual environment with poetry
152
162
153
163
The steps below must be performed in each Lambda function folder and e2e_automation folder to ensure the environment is correctly configured.
@@ -206,18 +216,6 @@ Steps:
206
216
207
217
It is not necessary to activate the virtual environment (using `source .venv/bin/activate`) before running a unit test suite from the command line; `direnv` will pick up the correct configurations for us. Run `pip list` to verify that the expected packages are installed. You should for example see that `recordprocessor` is specifically running `moto` v4, regardless of which if any `.venv` is active.
208
218
209
-
### Setting up the root level environment
210
-
211
-
The root-level virtual environment is primarily used for linting, as we create separate virtual environments for each folder that contains Lambda functions.
212
-
Steps:
213
-
214
-
1. Follow instructions above to [install dependencies](#install-dependencies) & [set up a virtual environment](#setting-up-a-virtual-environment-with-poetry).
215
-
**Note: While this project uses Python 3.11 (e.g. for Lambdas), the NHSDigital/api-management-utils repository — which orchestrates setup and linting — defaults to Python 3.8.
216
-
The linting command is executed from within that repo but calls the Makefile in this project, so be aware of potential Python version mismatches when running or debugging locally or in the pipeline.**
217
-
2. Run `make lint`. This will:
218
-
- Check the linting of the API specification yaml.
219
-
- Run Flake8 on all Python files in the repository, excluding files inside .venv and .terraform directories.
220
-
221
219
## IDE setup
222
220
223
221
The current team uses VS Code mainly. So this setup is targeted towards VS code. If you use another IDE please add the documentation to set up workspaces here.
0 commit comments