Files
chia-blockchain/ruff.toml
T
e947dd14c7 [LABS-244] Remove python 3.9 support (#20099)
* initial changes

* poetry fix

* Address ruff

* Install scripts issues

* Experiment a little bit

* Okay now try for rocky linux and use 3.12 instead

* Remove the now unused thing

* Use dnf for consistency

* Simplify installations

* Still need git

* relock poetry with 2.2.0

* relock poetry with 2.2.0

* try `git checkout main poetry.lock && .penv/bin/poetry lock` on altendky's system

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2025-10-14 07:19:52 -07:00

137 lines
3.8 KiB
TOML

line-length = 120
[lint]
preview = true
select = [
"PL", # Pylint
"I", # Isort
"FA", # Flake8: future-annotations
"UP", # Pyupgrade
"RUF", # Ruff specific
"F", # Flake8 core
"ASYNC", # Flake8 async
"ISC", # flake8-implicit-str-concat
"TID", # flake8-tidy-imports
"T10", # Debug statements
"EXE", # shebang usage
"ICN", # Import name conventions (i.e. import pandas as pd)
"INP", # Missing __init__.py
"Q", # quotes
"SLOT", # __slots__ usage
"TID", # Tidy imports
"FLY", # .join -> f-string
"PIE", # flake8 plugin for extra lints
"PYI", # type stubs linting
"RSE", # Linting raises
"S", # Potential security issues
# pycodestyle
"E",
"W",
# Trailing commas
# "COM812" # missing-trailing-comma (5105 errors)
"COM818",
"COM819",
# Libraries we don't use so might as well enable
"INT",
"AIR",
"FAST",
"DJ",
"NPY",
"PD",
]
explicit-preview-rules = false
ignore = [
# Pylint convention
"PLC0415", # import-outside-top-level
"PLC1901", # compare-to-empty-string
# Should probably fix these
"PLC2801", # unnecessary-dunder-call
"PLC2701", # import-private-name
# Pylint refactor
"PLR0915", # too-many-statements
"PLR0914", # too-many-locals
"PLR0913", # too-many-arguments
"PLR0912", # too-many-branches
"PLR1702", # too-many-nested-blocks
"PLR0904", # too-many-public-methods
"PLR0917", # too-many-positional-arguments
"PLR0916", # too-many-boolean-expressions
"PLR0911", # too-many-return-statements
# Should probably fix these
"PLR6301", # no-self-use
"PLR2004", # magic-value-comparison
# Pylint warning
"PLW1641", # eq-without-hash
# Should probably fix these
"PLW1514", # unspecified-encoding
"PLW0603", # global-statement
# Flake8 async
# Should probably fix these
"ASYNC230", # blocking-open-call-in-async-function
# Should probably fix these after dealing with shielding for anyio
"ASYNC109", # async-function-with-timeout
# flake8-implicit-str-concat
"ISC003", # explicit-string-concatenation
# Ruff Specific
# This code is problematic because using instantiated types as defaults is so common across the codebase.
# Its purpose is to prevent accidenatally assigning mutable defaults. However, this is a bit overkill for that.
# That being said, it would be nice to add some way to actually guard against that specific mutable default behavior.
"RUF009", # function-call-in-dataclass-default-argument
"RUF056", # falsy-dict-get-fallback
# Should probably fix this
"RUF029", # unused-async
# Security linter
"S603", # subprocess-without-shell-equals-true
# Should probably fix this
"S104", # hardcoded-bind-all-interfaces
"S110", # try-except-pass
"S112", # try-except-continue
"S311", # suspicious-non-cryptographic-random-usage
"S608", # hardcoded-sql-expression
# Need review on which of these we can/should fix
"S101", # assert
"S404", # suspicious-subprocess-import
"S607", # start-process-with-partial-path
# TODO: Remove these - it's a lot of errors
"UP045",
"UP007",
"UP035"
]
[lint.per-file-ignores]
"chia/_tests/*" = ["S106"]
[lint.flake8-implicit-str-concat]
# Found 3279 errors.
# allow-multiline = false
[lint.flake8-tidy-imports]
ban-relative-imports = "all"
[lint.flake8-tidy-imports.banned-api]
"asyncio.create_task".msg = "Use `from chia.util.task_referencer import create_referenced_task` and `create_referenced_task()`"
[lint.isort]
required-imports = ["from __future__ import annotations"]
[lint.pylint]
max-args = 5
max-locals = 15
max-returns = 6
max-branches = 12
max-statements = 50
max-nested-blocks = 5
max-public-methods = 20
max-bool-expr = 5
[lint.pyupgrade]
keep-runtime-typing = true