diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 71f9ac71ef..980a562610 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,11 +34,18 @@ repos: monai/_version.py )$ - #- repo: https://github.com/asottile/yesqa - # rev: v1.2.3 - # hooks: - # - id: yesqa - # name: Unused noqa + - repo: https://github.com/asottile/yesqa + rev: v1.2.3 + hooks: + - id: yesqa + name: Unused noqa + additional_dependencies: + - flake8>=3.8.1 + - flake8-bugbear + - flake8-comprehensions + - flake8-executable + - flake8-pyi + - pep8-naming #- repo: https://github.com/PyCQA/isort # rev: 5.9.3 diff --git a/docs/source/conf.py b/docs/source/conf.py index 324be8a0fd..46c905f99c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,7 +18,7 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) print(sys.path) -import monai # noqa: E402 +import monai # -- Project information ----------------------------------------------------- project = "MONAI" diff --git a/monai/__init__.py b/monai/__init__.py index 2c7c920162..7ab30bcae7 100644 --- a/monai/__init__.py +++ b/monai/__init__.py @@ -33,7 +33,7 @@ ), ) -from .utils.module import load_submodules # noqa: E402 +from .utils.module import load_submodules # handlers_* have some external decorators the users may not have installed # *.so files and folder "_C" may not exist when the cpp extensions are not compiled diff --git a/setup.cfg b/setup.cfg index 309169ebe8..19f04de526 100644 --- a/setup.cfg +++ b/setup.cfg @@ -83,9 +83,22 @@ max_line_length = 120 # C408 ignored because we like the dict keyword argument syntax # E501 is not flexible enough, we're using B950 instead ignore = - E203,E305,E402,E501,E721,E741,F821,F841,F999,W503,W504,C408,E302,W291,E303, - # N812 lowercase 'torch.nn.functional' imported as non lowercase 'F' - N812 + E203 + E305 + E402 + E501 + E721 + E741 + F821 + F841 + F999 + W503 + W504 + C408 + E302 + W291 + E303 + N812 # lowercase 'torch.nn.functional' imported as non lowercase 'F' per_file_ignores = __init__.py: F401 exclude = *.pyi,.git,.eggs,monai/_version.py,versioneer.py,venv,.venv,_version.py