Skip to content

Commit 0f25752

Browse files
chore: add pre-commit lint to remove trailing whitespace (#104)
* chore: add pre-commit lint to remove trailing whitespace * use ruff instead of tox
1 parent c7a4b0e commit 0f25752

File tree

38 files changed

+198
-187
lines changed

38 files changed

+198
-187
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name": "VS Code DEV Container for AWS CDK development",
33
"image": "jsii/superchain:1-buster-slim-node16"
4-
}
4+
}

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
## :warning: Checklist if your PR is changing anything else than documentation
22
- [ ] Posted the link to a successful manually triggered deployment workflow (successful including the resources destruction)
33

4-
## Merge request description
4+
## Merge request description

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
required: false
1313
DS_RELEASE_BOT_PRIVATE_KEY:
1414
required: false
15-
15+
1616
jobs:
1717
build_and_package:
1818
name: Build and package

.github/workflows/deploy.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deployment
22

33
on:
44
workflow_dispatch:
5-
5+
66
jobs:
77
build_package_and_deploy:
88
name: Build, package and deploy
@@ -30,7 +30,7 @@ jobs:
3030
- name: Generate distribution packages
3131
run: npm run package
3232

33-
33+
3434
- name: Install deployment environment
3535
id: install_deploy_env
3636
run: |
@@ -40,7 +40,7 @@ jobs:
4040
pip install dist/python/*.gz
4141
cd integration_tests/cdk
4242
pip install -r requirements.txt
43-
npm install
43+
npm install
4444
deactivate
4545
cd -
4646
@@ -56,7 +56,7 @@ jobs:
5656
PROJECT_ID: ${{ steps.short-sha.outputs.sha }}
5757
run: |
5858
source .deployment_venv/bin/activate
59-
59+
6060
# synthesize the stack
6161
cd integration_tests/cdk
6262
npx cdk synth --debug --all --require-approval never
@@ -65,7 +65,7 @@ jobs:
6565
npx cdk deploy --ci --all --require-approval never
6666
deactivate
6767
cd -
68-
68+
6969
- name: Tear down any infrastructure
7070
if: always()
7171
env:

.github/workflows/distribute.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
name: python
2020
path: dist
21-
21+
2222
- run: pip install twine
2323

2424
- run: twine upload dist/*

.github/workflows/lint.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python 3.11
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: 3.11
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
python -m pip install pre-commit
24+
25+
- name: Run pre-commit
26+
run: pre-commit run --all-files

.github/workflows/tox.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python: [3.9]
13+
python: [3.11]
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616
- name: Setup Python
17-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python }}
20+
2021
- name: Install Tox and any other packages
2122
run: pip install tox
23+
2224
- name: Run Tox
2325
# Run tox using the version of Python in `PATH`
2426
run: tox -e py

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ __pycache__
1010
.tox
1111
tests/*.egg*
1212
tests/*venv*
13-
tests/__pycache__
13+
tests/__pycache__

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
4+
# Optionally both commit and push
5+
default_stages: [commit]
6+
7+
# Regex for files to exclude
8+
# Don't lint the generated JSON metadata files
9+
exclude: "diagrams/"
10+
11+
repos:
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v4.0.1
14+
hooks:
15+
- id: trailing-whitespace
16+
- id: end-of-file-fixer
17+
18+
- repo: https://github.com/astral-sh/ruff-pre-commit
19+
rev: v0.4.4
20+
hooks:
21+
- id: ruff
22+
args: [--fix, --exit-non-zero-on-fix]
23+
- id: ruff-format

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ _Warning_: If you rebase `main`, you must ensure that the commits referenced by
5656

5757
## Tests
5858

59-
Each pull request to `main` is added to a [merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue#triggering-merge-group-checks-with-github-actions) so that a "deployment test" workflow can run before the merge actually happens. If the deployment fails, the merge is cancelled. Here is [the definition of this workflow](https://github.com/developmentseed/eoapi-cdk/blob/main/.github/workflows/deploy.yaml) and the [tests definition](https://github.com/developmentseed/eoapi-cdk/blob/main/tests).
59+
Each pull request to `main` is added to a [merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue#triggering-merge-group-checks-with-github-actions) so that a "deployment test" workflow can run before the merge actually happens. If the deployment fails, the merge is cancelled. Here is [the definition of this workflow](https://github.com/developmentseed/eoapi-cdk/blob/main/.github/workflows/deploy.yaml) and the [tests definition](https://github.com/developmentseed/eoapi-cdk/blob/main/tests).

0 commit comments

Comments
 (0)