Skip to content

Commit

Permalink
Add pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
samamorgan committed Nov 3, 2023
1 parent dd8b754 commit e658124
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 74 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/pre-commit-autoupdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Pre-commit auto-update

on:
# every day at midnight
schedule:
- cron: "0 0 * * *"
# on demand
workflow_dispatch:

jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2

- uses: browniebroke/pre-commit-autoupdate-action@main

- uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update/pre-commit-hooks
title: Update pre-commit hooks
commit-message: "chore: update pre-commit hooks"
body: Update versions of pre-commit hooks to latest version.
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
7 changes: 5 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@ jobs:
- name: Run tests
run: poetry run pytest --cov

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
args: [--unsafe]
- id: debug-statements
- id: mixed-line-ending

- repo: https://github.com/pycqa/doc8
rev: v1.1.1
hooks:
- id: doc8
entry: ./scripts/run_hook.py apps/rind python -m doc8
exclude: ^(?!(apps/rind)).*$

## Python
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
types: [python]

- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
types: [python]
171 changes: 106 additions & 65 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classifiers = [
"Bug Tracker" = "https://github.com/lightmatter/welkin-health/issues"

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"
requests = "^2.28.1"
portalocker = "^2.7.0"

Expand All @@ -27,6 +27,7 @@ optional = true
[tool.poetry.group.dev.dependencies]
black = "^22.10.0"
isort = "^5.10.1"
pre-commit = "^3.5.0"

[tool.poetry.group.test]
optional = true
Expand Down
1 change: 0 additions & 1 deletion test/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def test_document_summary_create(client, vcr_cassette):
reason="the bytes upload hits this issue in vcr: https://github.com/kevin1024/vcrpy/issues/660 but this test shows the correct implementation"
)
def test_document_summary_files_create(client, vcr_cassette):

with open("test/walrus_uJGKbRm.jpeg", "rb") as f:
files = client.DocumentSummaryFiles().create(
patient_id="283f50d3-0840-426f-b07b-bd8e4ab76401",
Expand Down
Loading

0 comments on commit e658124

Please sign in to comment.