Skip to content

Commit 0ff47d2

Browse files
authored
Merge pull request #111 from maxmind/greg/tox-linting
Use tox to run linters
2 parents 23f7085 + 98adc5d commit 0ff47d2

5 files changed

Lines changed: 32 additions & 43 deletions

File tree

.github/workflows/lint.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

minfraud/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
A client API to MaxMind's minFraud Score and Insights web services.
66
"""
77

8+
# flake8: noqa: F401
89
from .errors import (
910
MinFraudError,
1011
AuthenticationError,

minfraud/request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def maybe_hash_email(transaction):
9797
if at_idx == -1:
9898
return
9999

100-
domain = _clean_domain(address[at_idx + 1 :])
100+
domain = _clean_domain(address[at_idx + 1 :]) # noqa
101101
local_part = address[:at_idx]
102102

103103
if domain != "" and "domain" not in email:

minfraud/webservice.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
_REQUEST_UA = f"minFraud-API/{__version__} {requests.utils.default_user_agent()}"
3434

35+
3536
# pylint: disable=too-many-instance-attributes, missing-class-docstring
3637
class BaseClient:
3738
_account_id: str
@@ -74,7 +75,8 @@ def _handle_success(
7475
decoded_body = json.loads(raw_body)
7576
except ValueError as ex:
7677
raise MinFraudError(
77-
f"Received a 200 response but could not decode the response as JSON: {raw_body}",
78+
"Received a 200 response but could not decode the "
79+
f"response as JSON: {raw_body}",
7880
200,
7981
uri,
8082
) from ex

setup.cfg

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,40 @@ max-line-length = 88
99
universal = 1
1010

1111
[tox:tox]
12-
envlist = py36, py37, py38, py39, py310, mypy
12+
envlist = {py37,py38,py39,py310}-test,py310-{black,lint,flake8,mypy}
1313

1414
[gh-actions]
1515
python =
1616
3.7: py37
1717
3.8: py38
1818
3.9: py39
19-
"3.10": py310, mypy
19+
"3.10": py310,black,lint,flake8,mypy
2020

21-
[testenv]
21+
[testenv:{py37,py38,py39,py310}-test]
2222
deps =
23-
pytest
2423
mocket
24+
pytest
25+
26+
# explicitly require indirect dependency to fix build failure.
27+
# This can be removed when aiohttp 3.9 is released.
28+
charset-normalizer==2.1.1
2529
commands = pytest tests
30+
31+
[testenv:py310-black]
32+
deps = black
33+
commands = black --check --diff .
34+
35+
[testenv:py310-lint]
36+
deps = pylint
37+
commands = pylint minfraud
38+
39+
[testenv:py310-flake8]
40+
deps = flake8
41+
commands = flake8 minfraud
42+
43+
[testenv:py310-mypy]
44+
deps =
45+
mypy
46+
types-requests
47+
voluptuous-stubs
48+
commands = mypy minfraud tests

0 commit comments

Comments
 (0)