| 1 |
# SPDX-License-Identifier: Apache-2.0 |
| 2 |
# |
| 3 |
# Copyright (c) nexB Inc. and others. All rights reserved. |
| 4 |
# ScanCode is a trademark of nexB Inc. |
| 5 |
# SPDX-License-Identifier: Apache-2.0 |
| 6 |
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. |
| 7 |
# See https://github.com/aboutcode-org/skeleton for support or download. |
| 8 |
# See https://aboutcode.org for more information about nexB OSS projects. |
| 9 |
# |
| 10 |
|
| 11 |
# Python version can be specified with `$ PYTHON_EXE=python3.x make conf` |
| 12 |
PYTHON_EXE?=python3 |
| 13 |
VENV=venv |
| 14 |
ACTIVATE?=. ${VENV}/bin/activate; |
| 15 |
|
| 16 |
dev: |
| 17 |
@echo "-> Configure the development envt." |
| 18 |
./configure --dev |
| 19 |
|
| 20 |
isort: |
| 21 |
@echo "-> Apply isort changes to ensure proper imports ordering" |
| 22 |
${VENV}/bin/isort --sl -l 100 src tests setup.py |
| 23 |
|
| 24 |
black: |
| 25 |
@echo "-> Apply black code formatter" |
| 26 |
${VENV}/bin/black -l 100 src tests setup.py |
| 27 |
|
| 28 |
doc8: |
| 29 |
@echo "-> Run doc8 validation" |
| 30 |
@${ACTIVATE} doc8 --max-line-length 100 --ignore-path docs/_build/ --quiet docs/ |
| 31 |
|
| 32 |
valid: isort black |
| 33 |
|
| 34 |
check: |
| 35 |
@echo "-> Run pycodestyle (PEP8) validation" |
| 36 |
@${ACTIVATE} pycodestyle --max-line-length=100 --exclude=.eggs,venv,lib,thirdparty,docs,migrations,settings.py,.cache . |
| 37 |
@echo "-> Run isort imports ordering validation" |
| 38 |
@${ACTIVATE} isort --sl --check-only -l 100 setup.py src tests . |
| 39 |
@echo "-> Run black validation" |
| 40 |
@${ACTIVATE} black --check --check -l 100 src tests setup.py |
| 41 |
|
| 42 |
clean: |
| 43 |
@echo "-> Clean the Python env" |
| 44 |
./configure --clean |
| 45 |
|
| 46 |
test: |
| 47 |
@echo "-> Run the test suite" |
| 48 |
${VENV}/bin/pytest -vvs |
| 49 |
|
| 50 |
docs: |
| 51 |
rm -rf docs/_build/ |
| 52 |
@${ACTIVATE} sphinx-build docs/ docs/_build/ |
| 53 |
|
| 54 |
.PHONY: conf dev check valid black isort clean test docs |