Skip to content

Commit 845dc3d

Browse files
author
Tom Augspurger
committed
Added linting
1 parent 448f1b0 commit 845dc3d

5 files changed

Lines changed: 37 additions & 1 deletion

File tree

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
ignore = E402,W503
3+
max-line-length = 90

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Linting
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: main
8+
9+
jobs:
10+
checks:
11+
name: "pre-commit hooks"
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-python@v2
16+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/nbQA-dev/nbQA
3+
rev: 0.11.1
4+
hooks:
5+
- id: nbqa-black
6+
args: [--nbqa-mutate]
7+
- id: nbqa-flake8

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ And browse to the URL printed in the terminal output.
2828

2929
From there you'll be able to run all Jupyter Notebook examples.
3030

31+
### Linting
32+
33+
Notebooks are linted using [nbqa](https://nbqa.readthedocs.io/en/latest/) with flake8 and black.
34+
We include a [pre-commit](https://pre-commit.com/) file for running the checks.
35+
36+
```
37+
> pre-commit install
38+
```
39+
40+
3141
### Integration with Data Catalog site
3242

3343
Running the `./scripts/server` script also starts a local webserver that can

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN conda install -y python=3.8
3232
RUN python -m pip install --upgrade pip
3333
RUN conda install -y -c conda-forge gdal=3.2.0
3434

35-
RUN pip install setuptools cython numpy
35+
RUN pip install setuptools cython numpy pre-commit
3636

3737
# Install base packages
3838
RUN mkdir -p /opt/src

0 commit comments

Comments
 (0)