W003 function-on-column already catches function wrapping in WHERE.
The same pattern in JOIN ... ON is equally index-hostile but currently
slips through. Split into its own rule for clarity.
Should fail
SELECT *
FROM orders o
JOIN customers c ON UPPER(o.email) = UPPER(c.email);
Should pass
SELECT *
FROM orders o
JOIN customers c ON o.email_lower = c.email_lower;
Implementation hints
- Single-line rule.
- Look at
W003 and reuse its function list (YEAR|MONTH|UPPER|LOWER|...).
- Regex:
r"\bJOIN\b.*\bON\b.*\b(YEAR|MONTH|DAY|UPPER|LOWER|TRIM|CAST|CONVERT|SUBSTRING)\s*\("
- Severity:
warning.
Estimated LOC: ~25 code + ~15 test.
W003 function-on-columnalready catches function wrapping inWHERE.The same pattern in
JOIN ... ONis equally index-hostile but currentlyslips through. Split into its own rule for clarity.
Should fail
Should pass
Implementation hints
W003and reuse its function list (YEAR|MONTH|UPPER|LOWER|...).r"\bJOIN\b.*\bON\b.*\b(YEAR|MONTH|DAY|UPPER|LOWER|TRIM|CAST|CONVERT|SUBSTRING)\s*\("warning.Estimated LOC: ~25 code + ~15 test.