File tree Expand file tree Collapse file tree 5 files changed +57
-3
lines changed Expand file tree Collapse file tree 5 files changed +57
-3
lines changed Original file line number Diff line number Diff line change 3131 uses : actions/setup-python@v2
3232 with :
3333 python-version : ${{ matrix.python-version }}
34+ - name : Pre-commit Checks
35+ run : |
36+ pip -q install pre-commit
37+ pre-commit run --all-files
3438 - name : Install Python virtualenv for Github runner
3539 run : |
3640 python -m pip install --upgrade pip
Original file line number Diff line number Diff line change 22* .swp
33.DS_Store
44.git_submodule_init.done.log
5+ .venv-pre-commit
56__pycache__
67build
78dist
Original file line number Diff line number Diff line change 1+ repos :
2+ - repo : https://github.com/psf/black
3+ rev : 22.10.0
4+ hooks :
5+ - id : black
6+ - repo : https://github.com/pycqa/flake8
7+ rev : 5.0.4
8+ hooks :
9+ - id : flake8
10+ - repo : https://github.com/pycqa/isort
11+ rev : 5.10.1
12+ hooks :
13+ - id : isort
14+ name : isort (python)
Original file line number Diff line number Diff line change @@ -15,8 +15,8 @@ SHELL := /bin/bash
1515
1616PYTHON3 ?= python3
1717
18- # This recipe intentionally blank.
19- all :
18+ all : \
19+ .venv-pre-commit/var/.pre-commit-built.log
2020
2121.PHONY : \
2222 download
3333 .git_submodule_init.done.log
3434 touch $@
3535
36+ # This virtual environment is meant to be built once and then persist, even through 'make clean'.
37+ # If a recipe is written to remove this flag file, it should first run `pre-commit uninstall`.
38+ .venv-pre-commit/var/.pre-commit-built.log :
39+ rm -rf .venv-pre-commit
40+ test -r .pre-commit-config.yaml \
41+ || (echo " ERROR:Makefile:pre-commit is expected to install for this repository, but .pre-commit-config.yaml does not seem to exist." >&2 ; exit 1)
42+ $(PYTHON3 ) -m venv \
43+ .venv-pre-commit
44+ source .venv-pre-commit/bin/activate \
45+ && pip install \
46+ --upgrade \
47+ pip \
48+ setuptools \
49+ wheel
50+ source .venv-pre-commit/bin/activate \
51+ && pip install \
52+ pre-commit
53+ source .venv-pre-commit/bin/activate \
54+ && pre-commit install
55+ mkdir -p \
56+ .venv-pre-commit/var
57+ touch $@
58+
3659check : \
37- .git_submodule_init.done.log
60+ .git_submodule_init.done.log \
61+ .venv-pre-commit/var/.pre-commit-built.log
3862 $(MAKE) \
3963 PYTHON3=$(PYTHON3) \
4064 --directory tests \
Original file line number Diff line number Diff line change @@ -28,3 +28,14 @@ console_scripts =
2828
2929[options.package_data]
3030case_gnu_time = py.typed
31+
32+ [flake8]
33+ # https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
34+ extend-ignore =
35+ E203
36+ E302
37+ E501
38+
39+ [isort]
40+ # https://pycqa.github.io/isort/docs/configuration/black_compatibility.html
41+ profile = black
You can’t perform that action at this time.
0 commit comments