add pylint

This commit is contained in:
burnettk 2023-05-30 19:39:15 -04:00
parent 8befc5092f
commit aae043e0a4
4 changed files with 11 additions and 5 deletions

View File

@ -172,12 +172,19 @@ select = [
# "ERA", # eradicate # "ERA", # eradicate
"F", # pyflakes "F", # pyflakes
"N", # pep8-naming "N", # pep8-naming
# "PL", # pylint "PL", # pylint
# "S", # flake8-bandit # "S", # flake8-bandit
"UP", # pyupgrade "UP", # pyupgrade
"W", # pycodestyle warning "W", # pycodestyle warning
"I001" # isort "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 line-length = 130
# target python 3.10 # target python 3.10
@ -185,6 +192,7 @@ target-version = "py310"
[tool.ruff.per-file-ignores] [tool.ruff.per-file-ignores]
"migrations/versions/*.py" = ["E501"] "migrations/versions/*.py" = ["E501"]
"tests/**/*.py" = ["PLR2004"]
[tool.ruff.isort] [tool.ruff.isort]
force-single-line = true force-single-line = true

View File

@ -139,7 +139,7 @@ permission_cache = None
def get_users() -> Any: def get_users() -> Any:
"""Load users from a local configuration file.""" """Load users from a local configuration file."""
global permission_cache global permission_cache # noqa: PLW0603, allow global for performance
if not permission_cache: if not permission_cache:
with open(current_app.config["SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_ABSOLUTE_PATH"]) as file: with open(current_app.config["SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_ABSOLUTE_PATH"]) as file:
permission_cache = yaml.safe_load(file) permission_cache = yaml.safe_load(file)

View File

@ -160,7 +160,7 @@ class Script:
def get_all_subclasses(cls) -> list[type[Script]]: def get_all_subclasses(cls) -> list[type[Script]]:
"""Get_all_subclasses.""" """Get_all_subclasses."""
# This is expensive to generate, never changes after we load up. # 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: if not SCRIPT_SUB_CLASSES:
SCRIPT_SUB_CLASSES = Script._get_all_subclasses(Script) SCRIPT_SUB_CLASSES = Script._get_all_subclasses(Script)
return SCRIPT_SUB_CLASSES return SCRIPT_SUB_CLASSES

View File

@ -1,5 +1,3 @@
import json
import pytest import pytest
from flask.app import Flask from flask.app import Flask
from flask.testing import FlaskClient from flask.testing import FlaskClient