Skip to content

Commit a441aed

Browse files
committed
Use pylama instead of flake8
* run pylama and black outside of pytest, while we're at it
1 parent 56df883 commit a441aed

File tree

8 files changed

+49
-48
lines changed

8 files changed

+49
-48
lines changed

.flake8

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

.vscode/settings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"python.formatting.provider": "black",
3-
"python.linting.flake8Enabled": true,
43
"python.linting.enabled": true,
5-
"python.testing.pytestArgs": [],
6-
"python.testing.unittestEnabled": false,
4+
"python.linting.flake8Enabled": false,
5+
"python.linting.pylamaEnabled": true,
76
"python.testing.nosetestsEnabled": false,
7+
"python.testing.pytestArgs": [],
88
"python.testing.pytestEnabled": true,
9+
"python.testing.unittestEnabled": false,
910
"cSpell.words": [
1011
"Anonymizer",
1112
"DICOGNITO",

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ updated tests.
2222

2323
## Style
2424

25-
We use [flake8](http://flake8.pycqa.org/en/latest/) as a linter and [black](https://black.readthedocs.io/en/stable/)
26-
as a formatter. Please follow existing conventions. Any deviations will cause the tests to fail.
25+
We use [pylama](https://github.com/klen/pylama/) as a linter and [black](https://black.readthedocs.io/en/stable/)
26+
as a formatter. Please follow existing conventions. Any deviations will cause the build to fail.
2727

2828
## Making Changes
2929

mypy.ini

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

pyproject.toml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,40 @@ exclude = '''
1414
)/
1515
)
1616
'''
17+
[tool.pylama.linter.mypy]
18+
show_error_codes=true
19+
show_error_context=true
20+
show_column_numbers=true
21+
pretty=true
22+
color_output=true
23+
24+
warn_unreachable=true
25+
allow_redefinition=false
26+
27+
# treat Optional per PEP 484
28+
strict_optional=true
29+
30+
strict=true
31+
32+
[tool.pylama]
33+
linters = "mccabe,mypy,pycodestyle,pyflakes"
34+
skip = ".tox/*"
35+
36+
[[tool.pylama.linter.mypy.overrides]]
37+
module="pydicom.*"
38+
ignore_missing_imports = true
39+
40+
[[tool.pylama.linter.mypy.overrides]]
41+
module="pytest."
42+
ignore_missing_imports = true
43+
44+
[[tool.pylama.linter.mypy.overrides]]
45+
module="tests.*"
46+
allow_untyped_defs = true
47+
48+
[tool.pylama.linter.pycodestyle]
49+
ignore = "E203,W503"
50+
max_line_length = 120
1751

1852
[tool.pytest.ini_options]
1953
xfail_strict=true
20-
filterwarnings = [
21-
"error",
22-
"ignore:SelectableGroups:DeprecationWarning",
23-
"ignore:<class '.*'> is not using a cooperative constructor:pytest.PytestDeprecationWarning",
24-
"ignore:The \\(fspath. py.path.local\\) argument to .* is deprecated.:pytest.PytestDeprecationWarning",
25-
"ignore:.* is an Item subclass and should not be a collector.*:pytest.PytestWarning",
26-
]

src/dicognito/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from dicognito.summary import Summary
1818

1919

20-
def main(main_args: Optional[Sequence[str]] = None) -> None:
20+
def main(main_args: Optional[Sequence[str]] = None) -> None: # noqa: C901
2121
class VersionAction(argparse.Action):
2222
def __init__(
2323
self,

tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def add_source_to_sys_path():
1212
def test(context, like, loop=False):
1313
add_source_to_sys_path()
1414

15-
args = ["pytest", "--flake8", "--black"]
15+
args = ["pytest"]
1616
if like:
1717
args += ["-k", " or ".join(like)]
1818
if loop:

tox.ini

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ envlist = py37,py38,py39,py310
44
[testenv]
55
# install pytest in the virtualenv where commands will be executed
66
deps =
7-
pytest >= 7.0.1
8-
pytest-black
7+
black
98
pydicom>=2.1.1
10-
flake8<5
11-
pep8-naming
12-
pytest-flake8
13-
mypy
9+
pylama[mccabe,mypy,pycodestyle,pyflakes,toml]
10+
pytest >= 7.0.1
11+
1412
commands =
1513
# NOTE: you can run any command line tool here - not just tests
16-
pytest --flake8 --black {posargs}
17-
mypy src tests
14+
black --check --diff --quiet .
15+
pylama src tests
16+
pytest {posargs}

0 commit comments

Comments
 (0)