[build-system] requires = ["setuptools>=50.3.2", "setuptools_scm[toml]>=3.4"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] write_to = "saltpylint/version.py" write_to_template = "# pylint: skip-file\n\n__version__ = \"{version}\"\n" [tool.ruff] line-length = 120 show-fixes = true output-format = "grouped" target-version = "py38" respect-gitignore = true src = [ "saltpylint", "tests", "tools", "examples", ] extend-exclude = [ ".nox/**", ] extend-include = [ "setup.py", "noxfile.py", ] builtins = [ "__opts__", "__salt__", # "__context__", # "__grains__", # "__pillar__", "__salt_system_encoding__", ] [tool.ruff.lint] select = ["ALL"] ignore = [ # D* pydocstyle "D200", # Reformat to one line "D212", # Remove whitespace after opening quotes "COM", # flake8-commas - Black takes care of this "ERA", # eradicate "SIM108", # Use ternary operator `A = X if Y else Z` instead of `if`-`else`-block "PERF203", # `try`-`except` within a loop incurs performance overhead" "PERF401", # Use a list comprehension to create a transformed list "PERF402", # Use `list` or `list.copy` to create a copy of a list "ANN", # Type annotations ] ignore-init-module-imports = true [tool.ruff.lint.per-file-ignores] "**/*.py" = [ "D100", # Missing docstring in public module "D101", # Missing docstring in public class "D102", # Missing docstring in public method "D103", # Missing docstring in public function "D104", # Missing docstring in public package "D107", # Missing docstring in `__init__` "D205", # 1 blank line required between summary line and description "D415", # First line should end with a period, question mark, or exclamation point "PTH", # use pathlib.Path "ARG001", # Unused function argument: * "ARG002", # Unused method argument: * ] "setup.py" = [ "D", ] "noxfile.py" = [ "D", "ANN", "SLF001", "C901", "PLR0912", "DTZ005", "FBT002", "PLR0913", # Too many arguments to function call" "PLR0915", # Too many statements ] "saltpylint/blacklist.py" = [ "BLE001", # Do not catch blind exception: `Exception` ] "saltpylint/thirdparty.py" = [ "BLE001", # Do not catch blind exception: `Exception` ] "tools/**/*.py" = [ "ANN201", # Missing return type annotation for public function" "D104", # Missing docstring in public package "FBT001", # Boolean positional arg in function definition "FBT002", # Boolean default value in function definition ] "tests/**/*.py" = [ "ANN", # Ignore missing type annotations in tests "ARG001", # Unused function argument "DTZ003", # The use of `datetime.datetime.utcnow()` is not allowed, use `datetime.datetime.now(tz=)` instead "PLR2004", # Magic value used in comparison, consider replacing 3 with a constant variable "PT001", # use @pytest.fixture() over @pytest.fixture "PT023", # use @pytest.mark.() over @pytest.mark. "RET504", # Unnecessary variable assignment before `return` statement" "S101", # Ignore the use of 'assert ...' in tests "S603", # `subprocess` call: check for execution of untrusted input "SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements "TCH002", # Move third-party import into a type-checking block "TCH003", # Move standard library import `pathlib` into a type-checking block ] [tool.ruff.lint.flake8-quotes] docstring-quotes = "double" [tool.ruff.lint.pydocstyle] # Use Google-style docstrings. convention = "google" [tool.ruff.lint.isort] combine-as-imports = false force-single-line = true known-first-party = ["src"] forced-separate = ["tests"] [tool.ruff.lint.pep8-naming] ignore-names = [ "__virtual__", ] [tool.ruff.lint.pyupgrade] # Preserve types, even if a file imports `from __future__ import annotations`. keep-runtime-typing = true [tool.ruff.lint.mccabe] max-complexity = 45 [tool.ruff.lint.pylint] max-branches = 45 max-returns = 10 max-statements = 100