Skip to content

Commit

Permalink
pre-commit will manage all the linting (#1447)
Browse files Browse the repository at this point in the history
Linting will be managed through tox instead of in a github action job. This will make require one to only maintain the pre-commit hooks in .pre-commit-config.yaml file and the same configuration will automatically run on ci.yaml (through tox) and get updated due to another github action (pre-commit-autoupdate.yaml)
  • Loading branch information
arnav13081994 committed Sep 22, 2021
1 parent f89c64c commit 001b311
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 37 deletions.
19 changes: 1 addition & 18 deletions .github/workflows/ci.yml
Expand Up @@ -7,28 +7,11 @@ on:
branches: [master]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: python -m pip install flake8 isort black . djangorestframework
- name: Install and Run Pre-commit
uses: pre-commit/action@v2.0.3
- name: Check for missing migrations
run: python manage.py makemigrations --check --dry-run
env:
DJSTRIPE_TEST_DB_VENDOR: sqlite

# todo remove lint job and manage everything in tox.ini
# todo remove docs job and manage everything in tox.ini

docs:
runs-on: ubuntu-latest
needs: ["lint"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand All @@ -44,7 +27,7 @@ jobs:

tests:
runs-on: ubuntu-latest
needs: ["lint", "docs"]
needs: ["docs"]
strategy:
fail-fast: true
matrix:
Expand Down
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Expand Up @@ -25,10 +25,3 @@ repos:
hooks:
- id: flake8
additional_dependencies: [flake8-isort]


# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
ci:
autoupdate_schedule: weekly
skip: []
submodules: false
17 changes: 5 additions & 12 deletions tox.ini
@@ -1,6 +1,7 @@
[tox]
isolated_build = True
envlist =
pre-commit
py{36,37}-django{22,30,31,32}-{postgres,postgres-nativejson,mysql,sqlite}
py{38,39}-django{22,30}-{postgres,postgres-nativejson,mysql,sqlite}
py{38,39}-django{31,32,main}-{postgres,mysql,sqlite}{,-nativejson}
Expand All @@ -10,7 +11,7 @@ skip_missing_interpreters = True
python =
3.6: py36
3.7: py37
3.8: py38
3.8: py38, pre-commit
3.9: py39

[testenv]
Expand Down Expand Up @@ -38,16 +39,10 @@ deps =
pytest-django
pytest-cov

[testenv:lint]
[testenv:pre-commit]
skip_install = True
deps =
flake8
isort
black
commands =
flake8 {toxinidir} {posargs}
isort {toxinidir} --check --diff
black {toxinidir} --check
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure


[pytest]
Expand Down Expand Up @@ -78,5 +73,3 @@ max-line-length = 88


# todo add a section for docs
# todo add lint to gh-actions and envlist
# todo add a section for pre-commit

0 comments on commit 001b311

Please sign in to comment.