Commit Graph

13 Commits

Author SHA1 Message Date
Claude Code
dfd3f7b316 ci(lint): enforce no function-body imports (PLC0415) with targeted ignores
Follow-up to #40231 (merged), where a reviewer flagged a function-body
`from datetime import datetime, timedelta` instead of a top-of-file
import. Adds a `ruff-import-placement` pre-commit hook running
`ruff check --select PLC0415 --preview --no-fix`.

Per @rusackas's pushback on the first cut of this PR — which spammed
2,657 `# noqa: PLC0415` annotations across ~410 files without fixing
anything — this revision is a much smaller surface area:

1. **Per-file-ignores** for whole directories where function-body
   imports are a deliberate pattern, not an oversight:
   - `superset/cli/**` and `scripts/**`: subcommand-deferred imports
     keep heavy modules out of the CLI startup path.
   - `superset/tasks/**`: Celery task bodies defer imports of the
     modules they orchestrate.
   - `superset/migrations/versions/**`: Alembic migrations interact
     with model state at runtime, not at module load.
   - `superset/mcp_service/**`: MCP tools lazy-load resources on
     invocation so the server can register many tools without paying
     their import cost at startup.
   - `superset/db_engine_specs/**`: engine specs defer driver imports
     so optional DB drivers don't have to be installed.
   - `superset/initialization/__init__.py`, `superset/extensions/__init__.py`,
     `superset/app.py`: the app-factory and extension wiring are
     intentionally full of circular-import workarounds.
   - `tests/**`: test files routinely defer imports for fixture
     isolation; the rule still applies to production code.

2. **Per-line `# noqa: PLC0415`** on the 259 remaining genuine
   circular-import sites (security/manager.py, sql/execution/executor.py,
   semantic_layers/labels.py, tags/core.py, core_api_injection.py, etc.).
   These are foundational modules where moving the imports up would
   actually break things.

Net result: ~410 files / 2,657 grandfathered → ~73 files / 259 actual
noqa annotations. The rule still catches every new function-body
import outside the explicitly-allowed directories.

Also: silences a pre-existing C901 on `mcp_service/sql_lab/tool/execute_sql.py`
that fires under newer local ruff but not CI's pinned ruff 0.9.7 — blocks
the local pre-commit run otherwise.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 13:55:14 -07:00
Beto Dealmeida
c458f99dd4 chore: cleanup ssh tunnel (#34388) 2025-12-03 14:26:35 -05:00
Beto Dealmeida
f4105e9ed2 feat: default ports for SSH tunnel (#32403) 2025-02-27 10:59:48 -05:00
Craig Rueda
515452c7e2 chore(async): Making create app configurable (#25346) 2023-09-20 10:04:58 -07:00
EugeneTorap
fc89718d48 chore: Update pylint to 2.17.4 (#24700)
Co-authored-by: John Bodley <john.bodley@gmail.com>
2023-07-24 17:13:49 -07:00
Hugh A. Miles II
eb05225f0d feat(sshtunnel): add configuration for SSH_TIMEOUT (#24369) 2023-06-13 12:29:40 -04:00
Hugh A. Miles II
8b0c68c0d2 chore(ssh): Allow users to set TUNNEL_TIMEOUT from config (#24202) 2023-05-24 16:25:02 -04:00
Hugh A. Miles II
81b32d1045 chore: allow logs to show error levels for ssh tunnel (#23536) 2023-03-30 18:23:22 -04:00
Hugh A. Miles II
cb9bff72d6 fix(ssh-tunnel): add password to from_private_key function (#23175) 2023-02-24 16:05:37 -08:00
Hugh A. Miles II
196e3eac8b fix(sshtunnel): argument params to properly setting server_port (#23196) 2023-02-24 14:32:26 -08:00
Hugh A. Miles II
e6271f0ca7 fix(ssh-tunnel): update fields for open tunnel with private + private key passwords (#22764) 2023-01-18 14:56:36 +02:00
Hugh A. Miles II
c536f713d6 fix(ssh-tunnel): wrap pkey into StringIO buffer before creating the tunnel (#22763) 2023-01-18 00:52:18 +02:00
Hugh A. Miles II
ebaad10d6c feat(ssh-tunnelling): Setup SSH Tunneling Commands for Database Connections (#21912)
Co-authored-by: Antonio Rivero Martinez <38889534+Antonio-RiveroMartnez@users.noreply.github.com>
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
2023-01-03 17:22:42 -05:00