Rethink/rewrite rule 942130 with re2 support
See original GitHub issueMotivation
Allow porters to have more options for using CRS in additional engines.
Proposed solution
The rule 942130 (SQL Tautology) matches using these regexes:
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?=[\s'\"`()]*?(?:\b\1\b)
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?<=>[\s'\"`()]*?(?:\b\1\b)
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?like[\s'\"`()]*?(?:\b\1\b)
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?rlike[\s'\"`()]*?(?:\b\1\b)
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?sounds\s+like[\s'\"`()]*?(?:\b\1\b)
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?regexp[\s'\"`()]*?(?:\b\1\b)
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?!=[\s'\"`()]*?(?!\b\1\b)[\d\w]+
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?<=[\s'\"`()]*?(?!\b\1\b)[\d\w]+
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?>=[\s'\"`()]*?(?!\b\1\b)[\d\w]+
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?<>[\s'\"`()]*?(?!\b\1\b)[\d\w]+
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?<[\s'\"`()]*?(?!\b\1\b)[\d\w]+
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?>[\s'\"`()]*?(?!\b\1\b)[\d\w]+
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?\^[\s'\"`()]*?(?!\b\1\b)[\d\w]+
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?is\s+not[\s'\"`()]*?(?!\b\1\b)[\d\w]+
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?not\s+like[\s'\"`()]*?(?!\b\1\b)[\d\w]+
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?not\s+regexp[\s'\"`()]*?(?!\b\1\b)[\d\w]+
- The usage of
\1
is not compatible with re2, but we can probably change it for a named group like this:
[\s'\"`()]*?\b([\d\w]+)\b[\s'\"`()]*?=[\s'\"`()]*?(?:\b\1\b)
to
[\s'\"`()]*?\b(?P<one>[\d\w]+)\b[\s'\"`()]*?=[\s'\"`()]*?(?:\b(?P=one)\b)
- still we need to think if there is an alternative for the “before text not matching”
(?!\b
that breaks the compatibility
Alternatives
Additional context
Tests are really simple for this rule in particular, I wonder if there is additional information on how this rule was crafted.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (11 by maintainers)
Top Results From Across the Web
2019
$29.95T | £24.00 cloth 978-1-942130-15-4. 288 pp. | 6 x 9. April. Bob Dylan's reception of the 2016 Nobel Prize for Literature has...
Read more >2022 BUDGET PROPOSAL MAYOR JOHN HAMILTON
The department continues to support the Mayor's investment in ... Category 2 – Supplies request is $2,360 and represents no change over the ......
Read more >Sin título - Agencia Literaria Carmen Balcells
Life-long learning opportunities will support their ability to adapt to change. The only certainty about the future is change. Higher education.
Read more >googlelist.counts - Massachusetts Institute of Technology
the 23135932950 1 of 13151960974 2 and 12997686891 3 to 12137015015 4 a ... 76 also 616841255 77 now 611404229 78 help 611100561...
Read more >GAM Star Fund p.l.c.
Collective Investment in Transferable Securities) Regulations, ... investors to potentially make a rapid re-allocation to equities in the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I like the macro expansion. Gives us more flexibility. We need to check if this works 🤔
Fixed by #2425