From 92b185a26ac1d6920e752beba2260eb95bea1515 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 24 Nov 2021 11:03:48 +0000 Subject: [PATCH 1/2] Use only pre-commit for style linters and fixers The method of using the `Makefile`, running under `tox`, duplicated the work of pre-commit and pre-commit.ci. Additionally tox did not use the same pinned versions and arguments as in `.pre-commit-config.yaml`, so there is the potential for a version clash to cause the two paths to conflict, e.g. when a new version of Black is released. Sticking to only `pre-commit` seems sensible, saves some CI time, and allows some files to be removed. --- .github/workflows/test.yml | 2 +- .gitignore | 2 -- .pre-commit-config.yaml | 2 ++ Makefile | 24 +----------------------- docs/contributing.rst | 9 +++++++-- package.json | 6 ------ tox.ini | 9 --------- 7 files changed, 11 insertions(+), 43 deletions(-) delete mode 100644 package.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d4cf45f8..050d5b11d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -221,4 +221,4 @@ jobs: python -m pip install --upgrade tox - name: Test with tox - run: tox -e docs,style,packaging + run: tox -e docs,packaging diff --git a/.gitignore b/.gitignore index df5a2d10c..6caa61357 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,5 @@ docs/_build example/db.sqlite3 htmlcov .tox -node_modules -package-lock.json geckodriver.log coverage.xml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ce264484..7e6cd3f8b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,6 +38,8 @@ repos: - id: eslint files: \.js?$ types: [file] + args: + - --fix - repo: https://github.com/psf/black rev: 21.11b1 hooks: diff --git a/Makefile b/Makefile index 5b5ca4d76..1600496e5 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,4 @@ -.PHONY: flake8 example test coverage translatable_strings update_translations - -PRETTIER_TARGETS = '**/*.(css|js)' - -style: package-lock.json - isort . - black --target-version=py36 . - flake8 - npx eslint --ignore-path .gitignore --fix . - npx prettier --ignore-path .gitignore --write $(PRETTIER_TARGETS) - ! grep -r '\(style=\|onclick=\|