Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
16 changes: 16 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[flake8]
ignore =
# Refers to the max-line length. Let's suppress the error and simply
# let black take care on how it wants to format the lines.
E501,

# Refers to "line break before/after binary operator".
# Similar to above, let black take care of the formatting.
W503,
W504,

# black disagrees with flake8, and inserts whitespace
E203, # whitespace before ':'

# It seems flake8 can misfire on it
E401, # multiple imports on one line
17 changes: 0 additions & 17 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,19 +1,2 @@
[pytest]
doctest_optionflags = ALLOW_UNICODE ALLOW_BYTES
flake8-max-line-length = 88
flake8-ignore =
W503 # https://www.flake8rules.com/rules/W503.html
E203 # https://www.flake8rules.com/rules/E203.html

docs/conf.py E121 E122 E265 E401
tests/test_encoding.py E128 E221 E241 E302 E401 E501 E731
tests/test_form.py E265
tests/test_html.py E123 E128 E241 E303 E501 E502
tests/test_http.py E128 E261 E302 W291
tests/test_url.py E126 E127 E128 E226 E261 E303 E501 W293 W391
w3lib/encoding.py E126 E128 E302 E305 E401 E501
w3lib/form.py E402 E501 E721
w3lib/html.py E128 E302 E501 E502 W504
w3lib/http.py E501
w3lib/url.py E128 E261 E302 E305 E501 F841 W291 W293 W504
w3lib/util.py E302
4 changes: 3 additions & 1 deletion tests/test_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ def test_html_encoding(self):
self._assert_encoding_detected(None, "utf-8", codecs.BOM_UTF8 + body)

def test_autodetect(self):
asciif = lambda x: "ascii"
def asciif(x):
return "ascii"

body = b"""<meta charset="utf-8">"""
# body encoding takes precedence
self._assert_encoding_detected(None, "utf-8", body, auto_detect_fun=asciif)
Expand Down
13 changes: 8 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@ basepython = python3
deps =
# mypy would error if pytest (or its sub) not found
pytest
mypy==0.910
mypy==0.971
commands =
mypy --show-error-codes {posargs: w3lib tests}

[testenv:flake8]
basepython = python3
deps =
{[testenv]deps}
pytest-flake8
flake8
commands =
pytest --flake8
flake8 \
w3lib \
setup.py \
tests \
{posargs}

[testenv:pylint]
deps =
Expand All @@ -48,7 +51,7 @@ commands =

[testenv:black]
deps =
black==22.3.0
black==22.6.0
commands =
black --check {posargs:conftest.py setup.py tests w3lib}

Expand Down