@@ -31,13 +31,10 @@ string getMessage(Select sel) {
3131 * This fingerprint avoid false positives where two queries with the same ID behave differently (which is OK).
3232 */
3333string getSelectFingerPrint ( Select sel ) {
34- exists ( File file , QLDoc doc |
35- sel .getLocation ( ) .getFile ( ) = file and
36- any ( TopLevel top | top .getLocation ( ) .getFile ( ) = file ) .getQLDoc ( ) = doc
37- |
34+ exists ( QueryDoc doc | doc = sel .getQueryDoc ( ) |
3835 result =
39- doc .getContents ( ) . regexpCapture ( "(?s).*@id (\\w+)/([\\w\\-]+)\\s.*" , 2 ) // query ID (without lang)
40- + "-" + doc .getContents ( ) . regexpCapture ( "(?s).*@kind (\\w+)\\s.*" , 1 ) // @kind
36+ doc .getQueryId ( ) // query ID (without lang)
37+ + "-" + doc .getQueryKind ( ) // @kind
4138 + "-" +
4239 strictcount ( String e | e .getParent * ( ) = sel .getExpr ( any ( int i | i % 2 = 1 ) ) ) // the number of string constants in the select
4340 + "-" + count ( sel .getExpr ( _) ) // and the total number of expressions in the select
@@ -49,10 +46,10 @@ string getSelectFingerPrint(Select sel) {
4946 * The query-id (without language), the language, the message from the select, and a language agnostic fingerprint.
5047 */
5148Select parseSelect ( string id , string lang , string msg , string fingerPrint ) {
52- exists ( File file , QLDoc doc | result . getLocation ( ) . getFile ( ) = file |
53- any ( TopLevel top | top . getLocation ( ) . getFile ( ) = file ) . getQLDoc ( ) = doc and
54- id = doc .getContents ( ) . regexpCapture ( "(?s).*@id (\\w+)/([\\w\\-]+)\\s.*" , 2 ) and
55- lang = doc .getContents ( ) . regexpCapture ( "(?s).*@id (\\w+)/([\\w\\-]+)\\s.*" , 1 ) and
49+ exists ( QueryDoc doc |
50+ doc = result . getQueryDoc ( ) and
51+ id = doc .getQueryId ( ) and
52+ lang = doc .getQueryLanguage ( ) and
5653 fingerPrint = getSelectFingerPrint ( result ) and
5754 msg = getMessage ( result ) .toLowerCase ( ) // case normalize, because some languages upper-case methods.
5855 ) and
0 commit comments