Skip to content

Commit 1581b15

Browse files
committed
Add a "valid" Make command to run isort, black, and mypy
Signed-off-by: tdruez <tdruez@nexb.com>
1 parent a1d782b commit 1581b15

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ pip-selfcheck.json
1313
pyvenv.cfg
1414
.Python
1515
/.tox/
16-
/.pytest_cache/
16+
/.*_cache/
1717
venv

Makefile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
PYTHON_EXE?=python3
2727
ACTIVATE?=. bin/activate;
2828
VIRTUALENV_PYZ=thirdparty/virtualenv.pyz
29-
BLACK_ARGS=--exclude=".cache|migrations|data|lib|bin|var"
29+
BLACK_ARGS=--exclude=".cache|lib|bin|var" --line-length 100
3030

3131
virtualenv:
3232
@echo "-> Bootstrap the virtualenv with PYTHON_EXE=${PYTHON_EXE}"
@@ -46,9 +46,27 @@ clean:
4646
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ \
4747
-delete -type d -name '*.egg-info' -delete
4848

49+
isort:
50+
@echo "-> Apply isort changes to ensure proper imports ordering"
51+
@${ACTIVATE} isort --profile black src/ tests/
52+
53+
black:
54+
@echo "-> Apply black code formatter"
55+
@${ACTIVATE} black ${BLACK_ARGS} .
56+
57+
mypy:
58+
@echo "-> Type check the Python code."
59+
@${ACTIVATE} mypy
60+
61+
valid:
62+
@${ACTIVATE} pip install -e .[lint]
63+
@$(MAKE) isort
64+
@$(MAKE) black
65+
@$(MAKE) mypy
66+
4967
test:
5068
@echo "-> Run the test suite"
5169
${MANAGE} test --noinput
5270
bin/py.test tests
5371

54-
.PHONY: virtualenv conf dev clean test
72+
.PHONY: virtualenv conf dev clean isort black mypy valid test

tests/contrib/test_purl2url.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ def test_purl2url_get_inferred_urls():
129129
"https://gitlab.com/tg1999/firebase",
130130
"https://gitlab.com/tg1999/firebase/-/archive/1a122122/firebase-1a122122.tar.gz",
131131
],
132-
"pkg:pypi/sortedcontainers@2.4.0": [
133-
"https://pypi.org/project/sortedcontainers/2.4.0/"
134-
],
132+
"pkg:pypi/sortedcontainers@2.4.0": ["https://pypi.org/project/sortedcontainers/2.4.0/"],
135133
"pkg:rubygems/package-name": ["https://rubygems.org/gems/package-name"],
136134
"pkg:bitbucket/birkenfeld": [],
137135
}

0 commit comments

Comments
 (0)