Skip to content

Commit

Permalink
Merge pull request #24 from devilbox/pycodestyle
Browse files Browse the repository at this point in the history
Add pycodestyle
  • Loading branch information
cytopia authored Nov 27, 2022
2 parents 0592c8f + 0b745fe commit 0690177
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Makefile.python
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ PYLINT_PIP_PKGS =
PYLINT_ARGS =
PYLINT_DIR = .

# PyCodeStyle
PYCODE_VERSION = latest
PYCODE_ARGS =
PYCODE_DIR = .

# Black
BLACK_VERSION = latest
BLACK_LINT_ARGS = --check --diff
Expand All @@ -34,6 +39,7 @@ BLACK_DIR = .
.PHONY: lint
lint:: lint-mypy
lint:: lint-pylint
lint:: lint-pycode
lint:: lint-black


Expand All @@ -57,6 +63,16 @@ lint-pylint:
docker run --rm $$(tty -s && echo "-it" || echo) -e PIP_ROOT_USER_ACTION=ignore -v $$(pwd):/data -w /data --entrypoint=sh cytopia/pylint:$(PYLINT_VERSION) \
-c 'for pkg in $(PYLINT_PIP_PKGS); do python3 -m pip install $${pkg}; done && pylint $(PYLINT_ARGS) $(PYLINT_DIR)'

.PHONY: lint-pycode
lint-pycode: _lint-pycode-pull
lint-pycode:
@echo "################################################################################"
@echo "# Lint PyCodeStyle"
@echo "################################################################################"
docker run --rm $$(tty -s && echo "-it" || echo) -e PIP_ROOT_USER_ACTION=ignore -v $$(pwd):/data -w /data cytopia/pycodestyle:$(PYCODE_VERSION) \
$(PYCODE_ARGS) \
$(PYCODE_DIR)

.PHONY: lint-black
lint-black: _lint-black-pull
lint-black:
Expand Down Expand Up @@ -113,6 +129,19 @@ _lint-pylint-pull:
done; \
if [ "$${SUCC}" = "0" ]; then echo "FAILED"; exit 1; fi;

.PHONY: _lint-pycode-pull
_lint-pycode-pull:
@echo "Pulling cytopia/pycodestyle:$(PYCODE_VERSION)"; \
SUCC=0; \
for i in $$(seq 10); do \
if docker pull -q cytopia/pycodestyle:$(PYCODE_VERSION); then \
SUCC=1; \
break; \
fi; \
sleep 1; \
done; \
if [ "$${SUCC}" = "0" ]; then echo "FAILED"; exit 1; fi;

.PHONY: _lint-black-pull
_lint-black-pull:
@echo "Pulling cytopia/black:$(BLACK_VERSION)"; \
Expand Down

0 comments on commit 0690177

Please sign in to comment.