Switch from pycodestyle to flake8 for code style checks (#1083)

This commit is contained in:
Mickaël Schoentgen 2021-06-02 11:06:46 +02:00 committed by GitHub
parent 8d35a12d27
commit 350f973f70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 21 deletions

View File

@ -11,7 +11,7 @@ jobs:
python-version: 3.9 python-version: 3.9
- run: python -m pip install --upgrade pip setuptools wheel - run: python -m pip install --upgrade pip setuptools wheel
- run: make install - run: make install
- run: make pycodestyle - run: make codestyle
- run: make test-cover - run: make test-cover
- run: make codecov-upload - run: make codecov-upload
env: env:

View File

@ -123,7 +123,7 @@ Making Changes
-------------- --------------
Please make sure your changes conform to `Style Guide for Python Code`_ (PEP8) Please make sure your changes conform to `Style Guide for Python Code`_ (PEP8)
and that ``make pycodestyle`` passes. and that ``make codestyle`` passes.
Testing & CI Testing & CI
@ -152,7 +152,7 @@ HTTPie uses the `pytest`_ runner.
make test-cover make test-cover
# Test PEP8 compliance # Test PEP8 compliance
make pycodestyle make codestyle
# Run extended tests — for code as well as .rst files syntax, packaging, etc. # Run extended tests — for code as well as .rst files syntax, packaging, etc.
make test-all make test-all

View File

@ -88,7 +88,7 @@ test-cover: test
# test-all is meant to test everything — even this Makefile # test-all is meant to test everything — even this Makefile
test-all: clean install test test-dist pycodestyle test-all: clean install test test-dist codestyle
@echo @echo
@ -116,10 +116,15 @@ test-bdist-wheel: clean venv
twine-check: twine-check:
twine check dist/* twine check dist/*
pycodestyle:
@echo $(H1)Running pycodestyle$(H1END) # Kept for convenience, "make codestyle" is preferred though
@[ -f $(VENV_BIN)/pycodestyle ] || $(VENV_PIP) install pycodestyle pycodestyle: codestyle
$(VENV_BIN)/pycodestyle httpie/ tests/ extras/ *.py
codestyle:
@echo $(H1)Running flake8$(H1END)
@[ -f $(VENV_BIN)/flake8 ] || $(VENV_PIP) install --upgrade -r $(REQUIREMENTS)
$(VENV_BIN)/flake8 httpie/ tests/ extras/ *.py
@echo @echo

View File

@ -1,7 +1,11 @@
flake8
flake8-comprehensions
flake8-deprecated
flake8-mutable
flake8-tuple
pytest pytest
pytest-cov pytest-cov
pytest-httpbin>=0.0.6 pytest-httpbin>=0.0.6
docutils docutils
wheel wheel
pycodestyle
twine twine

View File

@ -11,17 +11,6 @@ norecursedirs = tests/fixtures .*
addopts = --tb=native --doctest-modules addopts = --tb=native --doctest-modules
[pycodestyle]
# <http://pycodestyle.pycqa.org/en/latest/intro.html#configuration>
exclude = .git,.idea,__pycache__,build,dist,.pytest_cache,*.egg-info
# <http://pycodestyle.pycqa.org/en/latest/intro.html#error-codes>
# E501 - line too long
# W503 - line break before binary operator
ignore = E501,W503
[flake8] [flake8]
# <https://flake8.pycqa.org/en/latest/user/error-codes.html> # <https://flake8.pycqa.org/en/latest/user/error-codes.html>
# E501 - line too long # E501 - line too long

View File

@ -52,7 +52,7 @@ class StdinBytesIO(BytesIO):
class MockEnvironment(Environment): class MockEnvironment(Environment):
"""Environment subclass with reasonable defaults for testing.""" """Environment subclass with reasonable defaults for testing."""
colors = 0 # For easier debugging colors = 0 # For easier debugging
stdin_isatty = True, stdin_isatty = True
stdout_isatty = True stdout_isatty = True
is_windows = False is_windows = False