Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 21 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,36 @@
SHELL := /bin/bash -euxo pipefail

include lint.mk

# Treat Sphinx warnings as errors
SPHINXOPTS := -W

.PHONY: lint
lint:
check-manifest .
doc8 .
dodgy
flake8 .
isort --recursive --check-only
mypy *.py src/ tests/ admin/
pip-extra-reqs src/
pip-missing-reqs src/
pydocstyle **
pylint *.py src tests
pyroma --min 10 .
vulture . --min-confidence 100
$(MAKE) -C docs spelling SPHINXOPTS=$(SPHINXOPTS)
$(MAKE) -C docs linkcheck SPHINXOPTS=$(SPHINXOPTS)
yapf \
--diff \
--recursive \
--exclude versioneer.py \
--exclude src/vws/_version.py \
.
lint: \
check-manifest \
doc8 \
flake8 \
isort \
linkcheck \
mypy \
pip-extra-reqs \
pip-missing-reqs \
pyroma \
shellcheck \
spelling \
vulture \
pylint \
pydocstyle \
yapf

.PHONY: fix-lint
fix-lint:
# Move imports to a single line so that autoflake can handle them.
# See https://github.com/myint/autoflake/issues/8.
# Then later we put them back.
isort --force-single-line --recursive --apply
autoflake \
--in-place \
--recursive \
--remove-all-unused-imports \
--remove-unused-variables \
--exclude src/vws/_version.py,versioneer.py \
.
yapf \
--in-place \
--recursive \
--exclude versioneer.py \
--exclude src/vws/_version.py \
.
$(MAKE) autoflake
$(MAKE) fix-yapf
isort --recursive --apply

.PHONY: docs
Expand All @@ -53,6 +39,4 @@ docs:

.PHONY: open-docs
open-docs:
xdg-open docs/build/html/index.html >/dev/null 2>&1 || \
open docs/build/html/index.html >/dev/null 2>&1 || \
echo "Requires 'xdg-open' or 'open' but neither is available."
python -c 'import os, webbrowser; webbrowser.open("file://" + os.path.abspath("docs/build/html/index.html"))'
88 changes: 88 additions & 0 deletions lint.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Make commands for linting

SHELL := /bin/bash -euxo pipefail

.PHONY: yapf
yapf:
yapf \
--diff \
--recursive \
--exclude versioneer.py \
--exclude src/*/_version.py \
.

.PHONY: fix-yapf
fix-yapf:
yapf \
--in-place \
--recursive \
--exclude versioneer.py \
--exclude src/*/_version.py \
.

.PHONY: mypy
mypy:
mypy *.py src/ tests/

.PHONY: check-manifest
check-manifest:
check-manifest .

.PHONY: doc8
doc8:
doc8 .

.PHONY: flake8
flake8:
flake8 .

.PHONY: isort
isort:
isort --recursive --check-only

.PHONY: pip-extra-reqs
pip-extra-reqs:
pip-extra-reqs src/

.PHONY: pip-missing-reqs
pip-missing-reqs:
pip-missing-reqs src/

.PHONY: pylint
pylint:
pylint *.py src/ tests/ admin/

.PHONY: pyroma
pyroma:
pyroma --min 10 .

.PHONY: vulture
vulture:
vulture --min-confidence 100 --exclude _vendor .

.PHONY: linkcheck
linkcheck:
$(MAKE) -C docs/ linkcheck SPHINXOPTS=$(SPHINXOPTS)

.PHONY: spelling
spelling:
$(MAKE) -C docs/ spelling SPHINXOPTS=$(SPHINXOPTS)

.PHONY: shellcheck
shellcheck:
shellcheck --exclude SC2164,SC1091 */*.sh

.PHONY: autoflake
autoflake:
autoflake \
--in-place \
--recursive \
--remove-all-unused-imports \
--remove-unused-variables \
--expand-star-imports \
--exclude _vendor,src/*/_version.py,versioneer.py,release \
.

.PHONY: pydocstyle
pydocstyle:
pydocstyle
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ignore =
tests-pylintrc
tests/*
vuforia_secrets.env.example
lint.mk

[flake8]
exclude=./versioneer.py,
Expand Down