You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e66e5f5
Browse filesBrowse the repository at this point in the historyBrowse files
fix(testing): keep Rule case offsets on Windows, and show an email Rule in the README (#12)
* docs: show a case-insensitive email Rule in the README example and demo
Co-authored-by: Kevin Longe <kvlonge@gmail.com>
* docs: require normalized operands in the README email Rule, test it, and split the speed table
The README Rule now flags an email comparison unless both sides are
LOWER(...) or a lower-case string literal, so LOWER(email) compared with a
mixed-case literal is reported. A test runs the README's code block through
evaluate_rule. The speed table separates the competitor comparison from
SQLClean's other configurations and drops the ratio column.
Co-authored-by: Kevin Longe <kvlonge@gmail.com>
* docs: move the README quick start before the speed tables
Co-authored-by: Kevin Longe <kvlonge@gmail.com>
* fix(testing): keep Rule case offsets right on Windows
evaluate_rule piped the case SQL to the native executable in text mode,
which on Windows turned each newline into CRLF, so statement text and
finding offsets drifted by one character per line. Send UTF-8 bytes.
Co-authored-by: Kevin Longe <kvlonge@gmail.com>
---------
<imgsrc="https://raw.githubusercontent.com/sqlstack-io/sqlclean/main/.github/demos/check-fix.gif"alt="sqlclean check reports an unused CTE, a temporary table from a custom Rule and a comparison with NULL; sqlclean fix removes the CTE and formats the file; sqlclean fix --unsafe-fixes rewrites = NULL to IS NULL"width="100%">
29
+
<imgsrc="https://raw.githubusercontent.com/sqlstack-io/sqlclean/main/.github/demos/check-fix.gif"alt="sqlclean check reports an unused CTE, a case-sensitive email comparison from a custom Rule and a comparison with NULL; sqlclean fix removes the CTE and formats the file; sqlclean fix --unsafe-fixes rewrites = NULL to IS NULL"width="100%">
30
30
</p>
31
31
32
-
`sqlclean check` reports an unused CTE, a temporary table from a custom Rule and a `= NULL`
33
-
comparison that is never true. `sqlclean fix` applies the safe fix, removing the CTE, and formats
34
-
the file. It leaves `= NULL` alone because rewriting it to `IS NULL` changes which rows match;
35
-
`sqlclean fix --unsafe-fixes` applies that fix. The custom Rule's finding has no fix, so it stays.
36
-
37
-
## Speed
38
-
39
-
Linting the same 10,282 Snowflake SQL files on 4 CPUs, with no cache:
40
-
41
-
| Command | Wall time | Time relative to `sqlclean check`|
0 commit comments