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 31
31
uses : actions/setup-python@v2
32
32
with :
33
33
python-version : ${{ matrix.python-version }}
34
+ - name : Pre-commit Checks
35
+ run : |
36
+ pip -q install pre-commit
37
+ pre-commit run --all-files
34
38
- name : Install Python virtualenv for Github runner
35
39
run : |
36
40
python -m pip install --upgrade pip
Original file line number Diff line number Diff line change 2
2
* .swp
3
3
.DS_Store
4
4
.git_submodule_init.done.log
5
+ .venv-pre-commit
5
6
__pycache__
6
7
build
7
8
dist
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
15
15
16
16
PYTHON3 ?= python3
17
17
18
- # This recipe intentionally blank.
19
- all :
18
+ all : \
19
+ .venv-pre-commit/var/.pre-commit-built.log
20
20
21
21
.PHONY : \
22
22
download
33
33
.git_submodule_init.done.log
34
34
touch $@
35
35
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
+
36
59
check : \
37
- .git_submodule_init.done.log
60
+ .git_submodule_init.done.log \
61
+ .venv-pre-commit/var/.pre-commit-built.log
38
62
$(MAKE) \
39
63
PYTHON3=$(PYTHON3) \
40
64
--directory tests \
Original file line number Diff line number Diff line change @@ -28,3 +28,14 @@ console_scripts =
28
28
29
29
[options.package_data]
30
30
case_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