Skip to content

Commit d5dedbb

Browse files
committed
Update to new lint style
1 parent 0aef2b8 commit d5dedbb

File tree

3 files changed

+110
-37
lines changed

3 files changed

+110
-37
lines changed

Makefile

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,36 @@
11
SHELL := /bin/bash -euxo pipefail
22

3+
include lint.mk
4+
35
# Treat Sphinx warnings as errors
46
SPHINXOPTS := -W
57

68
.PHONY: lint
7-
lint:
8-
check-manifest .
9-
doc8 .
10-
dodgy
11-
flake8 .
12-
isort --recursive --check-only
13-
mypy *.py src/ tests/ admin/
14-
pip-extra-reqs src/
15-
pip-missing-reqs src/
16-
pydocstyle **
17-
pylint *.py src tests
18-
pyroma --min 10 .
19-
vulture . --min-confidence 100
20-
$(MAKE) -C docs spelling SPHINXOPTS=$(SPHINXOPTS)
21-
$(MAKE) -C docs linkcheck SPHINXOPTS=$(SPHINXOPTS)
22-
yapf \
23-
--diff \
24-
--recursive \
25-
--exclude versioneer.py \
26-
--exclude src/vws/_version.py \
27-
.
9+
lint: \
10+
check-manifest \
11+
doc8 \
12+
flake8 \
13+
isort \
14+
linkcheck \
15+
mypy \
16+
pip-extra-reqs \
17+
pip-missing-reqs \
18+
pyroma \
19+
shellcheck \
20+
spelling \
21+
vulture \
22+
pylint \
23+
pydocstyle \
24+
yapf
2825

2926
.PHONY: fix-lint
3027
fix-lint:
3128
# Move imports to a single line so that autoflake can handle them.
3229
# See https://github.com/myint/autoflake/issues/8.
3330
# Then later we put them back.
3431
isort --force-single-line --recursive --apply
35-
autoflake \
36-
--in-place \
37-
--recursive \
38-
--remove-all-unused-imports \
39-
--remove-unused-variables \
40-
--exclude src/vws/_version.py,versioneer.py \
41-
.
42-
yapf \
43-
--in-place \
44-
--recursive \
45-
--exclude versioneer.py \
46-
--exclude src/vws/_version.py \
47-
.
32+
$(MAKE) autoflake
33+
$(MAKE) fix-yapf
4834
isort --recursive --apply
4935

5036
.PHONY: docs
@@ -53,6 +39,4 @@ docs:
5339

5440
.PHONY: open-docs
5541
open-docs:
56-
xdg-open docs/build/html/index.html >/dev/null 2>&1 || \
57-
open docs/build/html/index.html >/dev/null 2>&1 || \
58-
echo "Requires 'xdg-open' or 'open' but neither is available."
42+
python -c 'import os, webbrowser; webbrowser.open("file://" + os.path.abspath("docs/build/html/index.html"))'

lint.mk

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Make commands for linting
2+
3+
SHELL := /bin/bash -euxo pipefail
4+
5+
.PHONY: yapf
6+
yapf:
7+
yapf \
8+
--diff \
9+
--recursive \
10+
--exclude versioneer.py \
11+
--exclude src/*/_version.py \
12+
.
13+
14+
.PHONY: fix-yapf
15+
fix-yapf:
16+
yapf \
17+
--in-place \
18+
--recursive \
19+
--exclude versioneer.py \
20+
--exclude src/*/_version.py \
21+
.
22+
23+
.PHONY: mypy
24+
mypy:
25+
mypy *.py src/ tests/
26+
27+
.PHONY: check-manifest
28+
check-manifest:
29+
check-manifest .
30+
31+
.PHONY: doc8
32+
doc8:
33+
doc8 .
34+
35+
.PHONY: flake8
36+
flake8:
37+
flake8 .
38+
39+
.PHONY: isort
40+
isort:
41+
isort --recursive --check-only
42+
43+
.PHONY: pip-extra-reqs
44+
pip-extra-reqs:
45+
pip-extra-reqs src/
46+
47+
.PHONY: pip-missing-reqs
48+
pip-missing-reqs:
49+
pip-missing-reqs src/
50+
51+
.PHONY: pylint
52+
pylint:
53+
pylint *.py src/ tests/ admin/
54+
55+
.PHONY: pyroma
56+
pyroma:
57+
pyroma --min 10 .
58+
59+
.PHONY: vulture
60+
vulture:
61+
vulture --min-confidence 100 --exclude _vendor .
62+
63+
.PHONY: linkcheck
64+
linkcheck:
65+
$(MAKE) -C docs/ linkcheck SPHINXOPTS=$(SPHINXOPTS)
66+
67+
.PHONY: spelling
68+
spelling:
69+
$(MAKE) -C docs/ spelling SPHINXOPTS=$(SPHINXOPTS)
70+
71+
.PHONY: shellcheck
72+
shellcheck:
73+
shellcheck --exclude SC2164,SC1091 */*.sh
74+
75+
.PHONY: autoflake
76+
autoflake:
77+
autoflake \
78+
--in-place \
79+
--recursive \
80+
--remove-all-unused-imports \
81+
--remove-unused-variables \
82+
--expand-star-imports \
83+
--exclude _vendor,src/*/_version.py,versioneer.py,release \
84+
.
85+
86+
.PHONY: pydocstyle
87+
pydocstyle:
88+
pydocstyle

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ ignore =
3232
tests-pylintrc
3333
tests/*
3434
vuforia_secrets.env.example
35+
lint.mk
3536

3637
[flake8]
3738
exclude=./versioneer.py,

0 commit comments

Comments
 (0)