S001 implicit-cross-join catches FROM a, b. But explicit CROSS JOIN
slips through. Cross joins are rarely intentional outside of lookup-table
generation (calendars, cohort grids). Warn so the author confirms intent.
Should fail
SELECT *
FROM products p
CROSS JOIN regions r;
Should pass
SELECT *
FROM calendar_dates
CROSS JOIN (SELECT 1 AS n UNION ALL SELECT 2);
-- with an explicit "-- noqa: W018" comment to allow
Implementation hints
- Single-line rule.
- Regex:
r"\bCROSS\s+JOIN\b".
- Severity:
warning.
- Bonus: support
-- noqa: W018 comment to suppress.
Estimated LOC: ~20 code + ~15 test + (optional) noqa plumbing.
S001 implicit-cross-joincatchesFROM a, b. But explicitCROSS JOINslips through. Cross joins are rarely intentional outside of lookup-table
generation (calendars, cohort grids). Warn so the author confirms intent.
Should fail
Should pass
Implementation hints
r"\bCROSS\s+JOIN\b".warning.-- noqa: W018comment to suppress.Estimated LOC: ~20 code + ~15 test + (optional) noqa plumbing.