File tree Expand file tree Collapse file tree 5 files changed +57
-1
lines changed Expand file tree Collapse file tree 5 files changed +57
-1
lines changed Original file line number Diff line number Diff line change 32
32
uses : actions/setup-python@v2
33
33
with :
34
34
python-version : ${{ matrix.python-version }}
35
+ - name : Pre-commit Checks
36
+ run : |
37
+ pip -q install pre-commit
38
+ pre-commit run --all-files
35
39
- name : Start from clean state
36
40
run : make clean
37
41
- name : Run tests
Original file line number Diff line number Diff line change 4
4
* .swp
5
5
.generated- *
6
6
.pytest_cache
7
+ .venv-pre-commit
7
8
__pycache__
8
9
build
9
10
catalog-v001.xml
Original file line number Diff line number Diff line change
1
+ repos :
2
+ - repo : https://github.com/psf/black
3
+ rev : 22.6.0
4
+ hooks :
5
+ - id : black
6
+ - repo : https://github.com/pycqa/flake8
7
+ rev : 4.0.1
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 @@ -18,6 +18,7 @@ PYTHON3 ?= $(shell which python3.9 2>/dev/null || which python3.8 2>/dev/null ||
18
18
GSED ?= $(shell which gsed 2>/dev/null || which sed)
19
19
20
20
all : \
21
+ .venv-pre-commit/var/.pre-commit-built.log \
21
22
README.md
22
23
23
24
.PHONY : \
@@ -59,8 +60,32 @@ README.md: \
59
60
--directory lib
60
61
touch $@
61
62
63
+ # This virtual environment is meant to be built once and then persist, even through 'make clean'.
64
+ # If a recipe is written to remove this flag file, it should first run `pre-commit uninstall`.
65
+ .venv-pre-commit/var/.pre-commit-built.log :
66
+ rm -rf .venv-pre-commit
67
+ test -r .pre-commit-config.yaml \
68
+ || (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)
69
+ $(PYTHON3 ) -m venv \
70
+ .venv-pre-commit
71
+ source .venv-pre-commit/bin/activate \
72
+ && pip install \
73
+ --upgrade \
74
+ pip \
75
+ setuptools \
76
+ wheel
77
+ source .venv-pre-commit/bin/activate \
78
+ && pip install \
79
+ pre-commit
80
+ source .venv-pre-commit/bin/activate \
81
+ && pre-commit install
82
+ mkdir -p \
83
+ .venv-pre-commit/var
84
+ touch $@
85
+
62
86
# After running unit tests, see if README.md needs to be regenerated.
63
87
check : \
88
+ .venv-pre-commit/var/.pre-commit-built.log \
64
89
.lib.done.log
65
90
$(MAKE) \
66
91
PYTHON3=$(PYTHON3) \
@@ -80,7 +105,8 @@ clean:
80
105
clean
81
106
82
107
download : \
83
- .lib.done.log
108
+ .lib.done.log \
109
+ .venv-pre-commit/var/.pre-commit-built.log
84
110
$(MAKE) \
85
111
PYTHON3=$(PYTHON3) \
86
112
--directory tests \
Original file line number Diff line number Diff line change @@ -25,3 +25,14 @@ python_requires = >=3.7
25
25
[options.entry_points]
26
26
console_scripts =
27
27
case_shacl_inheritance_reviewer = case_shacl_inheritance_reviewer:main
28
+
29
+ [flake8]
30
+ # https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
31
+ extend-ignore =
32
+ E203
33
+ E302
34
+ E501
35
+
36
+ [isort]
37
+ # https://pycqa.github.io/isort/docs/configuration/black_compatibility.html
38
+ profile = black
You can’t perform that action at this time.
0 commit comments