Skip to content

Commit 6239af0

Browse files
committed
chore: add pylint disable comments for CodeFlow warnings
Add pylint disable comments to suppress CodeFlow warnings that ruff noqa comments cannot address (different linter codes): - hookspecs.py: module-level 'pylint: disable=unused-argument' for pluggy hookspec placeholder parameters (14 warnings) - _dispatch.py: 'pylint: disable=import-outside-toplevel' for circular dependency deferral (2 warnings) - ai_commands.py: same for circular dependency deferral (1 warning) - base_provider.py: same for optional rstr dependency (1 warning) - main.py: 'pylint: disable=unused-import' for CLI command registration side-effect import (1 warning) - sync_docs.py: 'pylint: disable=wrong-import-position' for sys.path- dependent import (1 warning) - test_doc_sync.py: same for sys.path-dependent import (1 warning) All 21 CodeFlow warnings addressed. ruff/mypy/pytest all pass.
1 parent 28169e4 commit 6239af0

8 files changed

Lines changed: 19 additions & 1 deletion

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,6 @@ node_modules/
8181

8282
# mkdocs build output (deployed via GitHub Actions, not committed)
8383
site/
84+
85+
# CodeFlow warning reports (local analysis artifacts, not for repo)
86+
codeflow-warnings*.md

scripts/sync_docs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
from pathlib import Path
1818

1919
sys.path.insert(0, str(Path(__file__).resolve().parent))
20-
from _fact_extractors import collect_all_facts # requires sys.path setup above
20+
# Import after sys.path manipulation — cannot be at module top.
21+
# pylint: disable=wrong-import-position
22+
from _fact_extractors import collect_all_facts
2123

2224
ROOT = Path(__file__).resolve().parent.parent
2325

src/sqlseed/cli/ai_commands.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ def _handle_ai_verification_streaming(
257257

258258

259259
def _write_ai_output(output: str, db_path: str, result: Any) -> None:
260+
# Import inside function to avoid circular dependency.
261+
# pylint: disable=import-outside-toplevel
260262
from sqlseed.cli.main import _sanitize_table_config # noqa: PLC0415
261263

262264
_sanitize_table_config(result)

src/sqlseed/cli/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ def main() -> None:
369369
# (ai_commands imports `cli` from this module at module level).
370370
# NOTE: Do NOT use contextlib.suppress here — it silently swallows
371371
# the circular ImportError that occurs when main.py is loaded first.
372+
# pylint: disable=unused-import
372373
try: # noqa: SIM105
373374
import sqlseed.cli.ai_commands # noqa: F401
374375
except ImportError:

src/sqlseed/generators/_dispatch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ def generate(self, type_name: str, **params: Any) -> Any:
5050

5151
def verify_dispatch_sync() -> None:
5252
"""Verify that GENERATOR_MAP entries match actual methods on BaseProvider."""
53+
# Imports inside function to avoid circular dependency at module load time.
54+
# pylint: disable=import-outside-toplevel
5355
from sqlseed.generators.base_provider import BaseProvider # noqa: PLC0415
5456

5557
for gen_name, method_name in GeneratorDispatchMixin._GENERATOR_MAP.items():

src/sqlseed/generators/base_provider.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ def _get_array_count(self) -> int:
351351
def _gen_pattern(self, *, pattern: str | None = None, regex: str | None = None) -> str:
352352
effective = pattern or regex or ""
353353
try:
354+
# Optional dependency — import inside function to defer ImportError.
355+
# pylint: disable=import-outside-toplevel
354356
import rstr as _rstr # noqa: PLC0415
355357
except ImportError as err:
356358
raise ImportError(

src/sqlseed/plugins/hookspecs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
import pluggy
66

7+
# pluggy hookspec methods use placeholder parameters that are intentionally
8+
# unused — they define the hook signature for plugin implementers.
9+
# pylint: disable=unused-argument
10+
711
hookspec = pluggy.HookspecMarker("sqlseed")
812
hookimpl = pluggy.HookimplMarker("sqlseed")
913

tests/test_doc_sync.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
# Import shared fact extractors from scripts/ to avoid code duplication.
2121
# This ensures tests validate the same logic that sync_docs.py uses.
2222
sys.path.insert(0, str(ROOT / "scripts"))
23+
# Import after sys.path manipulation — cannot be at module top.
24+
# pylint: disable=wrong-import-position
2325
from _fact_extractors import ( # noqa: E402
2426
get_enum_name_patterns,
2527
get_exact_match_rules,

0 commit comments

Comments
 (0)