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 3232 uses : actions/setup-python@v2
3333 with :
3434 python-version : ${{ matrix.python-version }}
35+ - name : Pre-commit Checks
36+ run : |
37+ pip -q install pre-commit
38+ pre-commit run --all-files
3539 - name : Start from clean state
3640 run : make clean
3741 - name : Run tests
Original file line number Diff line number Diff line change 44* .swp
55.generated- *
66.pytest_cache
7+ .venv-pre-commit
78__pycache__
89build
910catalog-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 ||
1818GSED ?= $(shell which gsed 2>/dev/null || which sed)
1919
2020all : \
21+ .venv-pre-commit/var/.pre-commit-built.log \
2122 README.md
2223
2324.PHONY : \
@@ -59,8 +60,32 @@ README.md: \
5960 --directory lib
6061 touch $@
6162
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+
6286# After running unit tests, see if README.md needs to be regenerated.
6387check : \
88+ .venv-pre-commit/var/.pre-commit-built.log \
6489 .lib.done.log
6590 $(MAKE) \
6691 PYTHON3=$(PYTHON3) \
@@ -80,7 +105,8 @@ clean:
80105 clean
81106
82107download : \
83- .lib.done.log
108+ .lib.done.log \
109+ .venv-pre-commit/var/.pre-commit-built.log
84110 $(MAKE) \
85111 PYTHON3=$(PYTHON3) \
86112 --directory tests \
Original file line number Diff line number Diff line change @@ -25,3 +25,14 @@ python_requires = >=3.7
2525[options.entry_points]
2626console_scripts =
2727 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