mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Follow-up to #105171, which added `ruff` with a deliberately narrow, bug-class-only rule set and left the unused-name and star-import rules off pending a dedicated cleanup pass. This enables that second batch in `pyproject.toml` and fixes every violation across the tree (the bulk in integration tests): - `F401` unused-import and `F841` unused-variable: removed, preserving any side-effecting right-hand side (e.g. `result = node.query(...)` becomes `node.query(...)`). Two `try: import ...` feature probes are kept with `# noqa: F401`. - `F541` f-string-missing-placeholders: dropped the redundant `f` prefix. - `F403`/`F405` star imports: every `from module import *` is expanded into explicit imports of the names actually used, taken from each name's real origin, so stdlib/third-party names import from their real source rather than through a test "convenience bundle". The now-empty `tests/integration/helpers/kafka/common_direct.py` bundle is removed and its three remaining consumers import `_VarintBytes`/`KafkaAdminClient` directly. Eliminating the star imports surfaced a real bug the wildcard had masked from `F821`: `generate_presets.py` in `test_prometheus_protocols` called an undefined `execute_instant_query_with_http_api`; fixed to the existing `execute_query_via_http_api`. No `black`/`isort` reformatting was applied (neither is enforced in the style check), so the diff is limited to the lint fixes themselves. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
82 lines
2.6 KiB
TOML
82 lines
2.6 KiB
TOML
[tool.pylint.BASIC]
|
|
max-module-lines=2000
|
|
# due to SQL
|
|
max-line-length=200
|
|
# Drop/decrease them one day:
|
|
max-branches=50
|
|
max-nested-blocks=10
|
|
max-statements=200
|
|
|
|
[tool.pylint.FORMAT]
|
|
#ignore-long-lines = (# )?<?https?://\S+>?$
|
|
|
|
[tool.pylint.'MESSAGES CONTROL']
|
|
# pytest.mark.parametrize is not callable (not-callable)
|
|
disable = '''
|
|
bare-except,
|
|
broad-except,
|
|
cell-var-from-loop,
|
|
fixme,
|
|
invalid-name,
|
|
missing-docstring,
|
|
redefined-outer-name,
|
|
too-few-public-methods,
|
|
too-many-arguments,
|
|
too-many-instance-attributes,
|
|
too-many-locals,
|
|
too-many-public-methods,
|
|
wildcard-import,
|
|
'''
|
|
|
|
[tool.isort]
|
|
profile = "black"
|
|
src_paths = ["src", "tests/ci", "tests/sqllogic", "tests/queries", "tests/integration"]
|
|
|
|
[tool.black]
|
|
required-version = 26
|
|
|
|
[tool.pylint.SIMILARITIES]
|
|
# due to SQL
|
|
min-similarity-lines=1000
|
|
|
|
[tool.ruff]
|
|
line-length = 200
|
|
target-version = "py312"
|
|
extend-exclude = [
|
|
"contrib",
|
|
"build",
|
|
"build_*",
|
|
"tmp",
|
|
# Generated protobuf bindings (top-level names defined dynamically).
|
|
"**/*_pb2.py",
|
|
"**/*_pb2_grpc.py",
|
|
]
|
|
|
|
[tool.ruff.lint]
|
|
# The first batch (F402/F522/F523/F601/F632/F811/F821) was hand-picked because
|
|
# every hit was either a genuine bug or an obviously dead reference (e.g.
|
|
# PR #105159: undefined name in an f-string only evaluated on a diagnostic
|
|
# branch, masking the real failure).
|
|
#
|
|
# The unused-name / star-import rules below (F401/F403/F405/F541/F841) were
|
|
# enabled in a follow-up after a dedicated cleanup pass: unused imports and
|
|
# variables removed (keeping side-effecting calls), placeholder-less f-strings
|
|
# de-prefixed, and every `from module import *` expanded into explicit imports.
|
|
# Eliminating the star imports also turned up a real bug — a call to an
|
|
# undefined `execute_instant_query_with_http_api` in the prometheus presets
|
|
# helper that the wildcard had been masking from F821.
|
|
select = [
|
|
"F401", # unused-import
|
|
"F402", # import-shadowed-by-loop-var
|
|
"F403", # undefined-local-with-import-star (`from module import *`)
|
|
"F405", # undefined-local-with-import-star-usage
|
|
"F522", # string-format-extra-named-arg
|
|
"F523", # string-format-extra-positional-arg
|
|
"F541", # f-string-missing-placeholders
|
|
"F601", # multi-value-repeated-key-literal
|
|
"F632", # is-literal (e.g. `x is "foo"`, always False under CPython)
|
|
"F811", # redefined-while-unused (duplicate function/import definitions)
|
|
"F821", # undefined-name (the PR #105159 class)
|
|
"F841", # local-variable-assigned-but-never-used
|
|
]
|