Skip to content

Commit e4cfaf3

Browse files
committed
feat(lint): add bash script to lint all scripts/notebooks more easily
1 parent da16a9e commit e4cfaf3

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

.github/workflows/lint.yaml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ jobs:
2323
cache: 'pip'
2424
- run: pip install -r requirements.txt
2525

26-
- name: Lint model code
26+
- name: Lint
2727
run: |
28-
pylint ./simulation
29-
30-
- name: Lint tests
31-
run: |
32-
pylint ./tests
33-
34-
- name: Lint notebooks
35-
run: |
36-
nbqa pylint ./notebooks
37-
38-
- name: Lint time-weighted averages notebook
39-
run: |
40-
nbqa pylint ./docs/time_weighted_averages.ipynb
28+
bash lint.sh

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ You can lint the `.ipynb` by adding `nbqa` to the start of the command - e.g.:
174174
nbqa pylint notebooks/analysis.ipynb
175175
```
176176

177+
A bash script has been provided which can be used to lint all files in succession by running:
178+
179+
```
180+
bash lint.sh
181+
```
182+
177183
<br>
178184

179185
## ❓ How does the model work?
@@ -223,6 +229,7 @@ repo/
223229
├── CONTRIBUTING.md # Contribution instructions
224230
├── environment.yaml # Conda environment (includes Python version)
225231
├── LICENSE # Licence file
232+
├── lint.sh # Bash script to lint all .py and .ipynb files at once
226233
├── pyproject.toml # Metadata for local `simulation/` package
227234
├── README.md # This file! Describes the repository
228235
└── requirements.txt # Virtual environment (used by GitHub actions)

lint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
echo "Linting model code..."
4+
pylint ./simulation
5+
6+
echo "Linting tests..."
7+
pylint ./tests
8+
9+
echo "Linting notebooks..."
10+
nbqa pylint ./notebooks
11+
12+
echo "Linting time-weighted averages notebook..."
13+
nbqa pylint ./docs/time_weighted_averages.ipynb

0 commit comments

Comments
 (0)