Skip to content

Commit

Permalink
Merge pull request #130 from blairconrad/pylama
Browse files Browse the repository at this point in the history
Switch from pyflakes to pylama
  • Loading branch information
blairconrad authored Aug 17, 2022
2 parents 56df883 + a441aed commit b02a24b
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 48 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

7 changes: 4 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"python.formatting.provider": "black",
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.testing.pytestArgs": [],
"python.testing.unittestEnabled": false,
"python.linting.flake8Enabled": false,
"python.linting.pylamaEnabled": true,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestArgs": [],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"cSpell.words": [
"Anonymizer",
"DICOGNITO",
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ updated tests.

## Style

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

## Making Changes

Expand Down
23 changes: 0 additions & 23 deletions mypy.ini

This file was deleted.

41 changes: 34 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,40 @@ exclude = '''
)/
)
'''
[tool.pylama.linter.mypy]
show_error_codes=true
show_error_context=true
show_column_numbers=true
pretty=true
color_output=true

warn_unreachable=true
allow_redefinition=false

# treat Optional per PEP 484
strict_optional=true

strict=true

[tool.pylama]
linters = "mccabe,mypy,pycodestyle,pyflakes"
skip = ".tox/*"

[[tool.pylama.linter.mypy.overrides]]
module="pydicom.*"
ignore_missing_imports = true

[[tool.pylama.linter.mypy.overrides]]
module="pytest."
ignore_missing_imports = true

[[tool.pylama.linter.mypy.overrides]]
module="tests.*"
allow_untyped_defs = true

[tool.pylama.linter.pycodestyle]
ignore = "E203,W503"
max_line_length = 120

[tool.pytest.ini_options]
xfail_strict=true
filterwarnings = [
"error",
"ignore:SelectableGroups:DeprecationWarning",
"ignore:<class '.*'> is not using a cooperative constructor:pytest.PytestDeprecationWarning",
"ignore:The \\(fspath. py.path.local\\) argument to .* is deprecated.:pytest.PytestDeprecationWarning",
"ignore:.* is an Item subclass and should not be a collector.*:pytest.PytestWarning",
]
2 changes: 1 addition & 1 deletion src/dicognito/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from dicognito.summary import Summary


def main(main_args: Optional[Sequence[str]] = None) -> None:
def main(main_args: Optional[Sequence[str]] = None) -> None: # noqa: C901
class VersionAction(argparse.Action):
def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def add_source_to_sys_path():
def test(context, like, loop=False):
add_source_to_sys_path()

args = ["pytest", "--flake8", "--black"]
args = ["pytest"]
if like:
args += ["-k", " or ".join(like)]
if loop:
Expand Down
15 changes: 7 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ envlist = py37,py38,py39,py310
[testenv]
# install pytest in the virtualenv where commands will be executed
deps =
pytest >= 7.0.1
pytest-black
black
pydicom>=2.1.1
flake8<5
pep8-naming
pytest-flake8
mypy
pylama[mccabe,mypy,pycodestyle,pyflakes,toml]
pytest >= 7.0.1

commands =
# NOTE: you can run any command line tool here - not just tests
pytest --flake8 --black {posargs}
mypy src tests
black --check --diff --quiet .
pylama src tests
pytest {posargs}

0 comments on commit b02a24b

Please sign in to comment.