Run pre-commit checks before landing changes.

Add `pre-commit` to the requirements list, and updated the version it uses.
Also removed the `sample.adoc` since the relevant test always creates it (and
it was causing spurious lint check errors).
This commit is contained in:
Natalia
2023-06-14 15:40:09 -03:00
committed by nessita
parent c66bcccab8
commit 2e0f083dad
6 changed files with 33 additions and 17 deletions

View File

@@ -63,9 +63,9 @@ jobs:
run: |
python -m pytest
- name: Lints with Black
- name: Lints with pre-commit
run: |
python -m black --check .
pre-commit run -a
build:
needs: [test]

View File

@@ -1,11 +1,11 @@
default_language_version:
python: python3.11
exclude: .*migrations\/.*|static\/img\/.*|static\/animations\/.*
exclude: .*migrations\/.*|static\/img\/.*|static\/animations\/.*|kube\/boost\/templates\/.*\.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
@@ -17,12 +17,12 @@ repos:
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.263'
rev: v0.0.272
hooks:
- id: ruff
args: [--fix]
- repo: https://github.com/rtts/djhtml
rev: 'v2.0.0'
rev: 3.0.6
hooks:
- id: djhtml
entry: djhtml --tabwidth 2

View File

@@ -1,3 +0,0 @@
== Test Document
This is a test.

View File

@@ -8,8 +8,9 @@ import os
def cleanup_test_asciidoc():
# This function will be executed after the test function completes
def remove_files():
expected_output_file = "core/tests/sample.html"
os.remove(os.path.join(settings.BASE_DIR, expected_output_file))
for extension in ("adoc", "html"):
expected_output_file = f"core/tests/sample.{extension}"
os.remove(os.path.join(settings.BASE_DIR, expected_output_file))
# Yield control back to the test function
yield

View File

@@ -34,17 +34,18 @@ celery==5.2.7
redis==4.5.4
# Testing
black==22.3
Faker
black
django-bakery
django-test-plus
ipython
minio
model_bakery
pre-commit
pytest
pytest-cov
pytest-django
Faker
model_bakery
ipython
responses
minio
# Packaging
pip-tools==6.13.0

View File

@@ -44,6 +44,8 @@ certifi==2023.5.7
# requests
cffi==1.15.1
# via cryptography
cfgv==3.3.1
# via pre-commit
charset-normalizer==3.1.0
# via requests
click==8.1.3
@@ -72,6 +74,8 @@ decorator==5.1.1
# via ipython
defusedxml==0.7.1
# via python3-openid
distlib==0.3.6
# via virtualenv
dj-database-url==2.0.0
# via environs
dj-email-url==1.0.6
@@ -149,6 +153,8 @@ faker==18.9.0
# via -r ./requirements.in
fastcore==1.5.29
# via ghapi
filelock==3.12.2
# via virtualenv
fs==2.4.16
# via django-bakery
gevent==22.10.2
@@ -161,6 +167,8 @@ greenlet==2.0.1
# gevent
gunicorn==20.1.0
# via -r ./requirements.in
identify==2.5.24
# via pre-commit
idna==3.4
# via requests
iniconfig==2.0.0
@@ -189,6 +197,8 @@ model-bakery==1.11.0
# via -r ./requirements.in
mypy-extensions==1.0.0
# via black
nodeenv==1.8.0
# via pre-commit
oauthlib==3.2.2
# via requests-oauthlib
packaging==23.1
@@ -213,9 +223,13 @@ pillow==9.4.0
pip-tools==6.13.0
# via -r ./requirements.in
platformdirs==3.5.1
# via black
# via
# black
# virtualenv
pluggy==1.0.0
# via pytest
pre-commit==3.3.3
# via -r ./requirements.in
prompt-toolkit==3.0.38
# via
# click-repl
@@ -264,6 +278,7 @@ pytz==2023.3
# djangorestframework
pyyaml==6.0
# via
# pre-commit
# python-frontmatter
# responses
redis==4.5.4
@@ -317,6 +332,8 @@ vine==5.0.0
# via
# celery
# kombu
virtualenv==20.23.0
# via pre-commit
wcwidth==0.2.6
# via prompt-toolkit
wheel==0.40.0