From aae043e0a4e656ae266fb560e36b5f9d382f12fa Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 30 May 2023 19:39:15 -0400 Subject: [PATCH] add pylint --- spiffworkflow-backend/pyproject.toml | 10 +++++++++- .../routes/openid_blueprint/openid_blueprint.py | 2 +- .../src/spiffworkflow_backend/scripts/script.py | 2 +- .../integration/test_secret_service.py | 2 -- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/spiffworkflow-backend/pyproject.toml b/spiffworkflow-backend/pyproject.toml index f116d4a35..6e4e8342b 100644 --- a/spiffworkflow-backend/pyproject.toml +++ b/spiffworkflow-backend/pyproject.toml @@ -172,12 +172,19 @@ select = [ # "ERA", # eradicate "F", # pyflakes "N", # pep8-naming - # "PL", # pylint + "PL", # pylint # "S", # flake8-bandit "UP", # pyupgrade "W", # pycodestyle warning "I001" # isort ] + +ignore = [ + "PLR", # "refactoring" category has "too many lines in method" type stuff + "PLC1901", + "PLE1205" # saw this Too many arguments for `logging` format string give a false positive once +] + line-length = 130 # target python 3.10 @@ -185,6 +192,7 @@ target-version = "py310" [tool.ruff.per-file-ignores] "migrations/versions/*.py" = ["E501"] +"tests/**/*.py" = ["PLR2004"] [tool.ruff.isort] force-single-line = true diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/openid_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/openid_blueprint.py index c2741d6ed..2bace0004 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/openid_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/openid_blueprint.py @@ -139,7 +139,7 @@ permission_cache = None def get_users() -> Any: """Load users from a local configuration file.""" - global permission_cache + global permission_cache # noqa: PLW0603, allow global for performance if not permission_cache: with open(current_app.config["SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_ABSOLUTE_PATH"]) as file: permission_cache = yaml.safe_load(file) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py index 5992bff0c..c22d0873b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py @@ -160,7 +160,7 @@ class Script: def get_all_subclasses(cls) -> list[type[Script]]: """Get_all_subclasses.""" # This is expensive to generate, never changes after we load up. - global SCRIPT_SUB_CLASSES + global SCRIPT_SUB_CLASSES # noqa: PLW0603, allow global for performance if not SCRIPT_SUB_CLASSES: SCRIPT_SUB_CLASSES = Script._get_all_subclasses(Script) return SCRIPT_SUB_CLASSES diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py index 20e48b808..1b4b142f9 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py @@ -1,5 +1,3 @@ -import json - import pytest from flask.app import Flask from flask.testing import FlaskClient