File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change 11/**
22 * @name Android query without android @id prefix
3- * @description Android queries should include the `android` prefix in their `@id`.
3+ * @description Android queries should include the `android/ ` prefix in their `@id`.
44 * @kind problem
55 * @problem.severity warning
66 * @id ql/android-id-prefix
99
1010import ql
1111
12- string getIdProperty ( QLDoc doc ) {
13- result = any ( string id | id = doc .getContents ( ) .splitAt ( "@" ) and id .matches ( "id %" ) )
14- }
15-
12+ /** Holds if `t` transitively imports an Android module. */
1613predicate importsAndroidModule ( TopLevel t ) {
1714 exists ( Import i | t .getAnImport ( ) = i |
1815 i .getImportString ( ) .toLowerCase ( ) .matches ( "%android%" )
@@ -24,9 +21,9 @@ predicate importsAndroidModule(TopLevel t) {
2421 )
2522}
2623
27- from TopLevel t
24+ from QueryDoc d
2825where
29- t .getLocation ( ) .getFile ( ) .getRelativePath ( ) .matches ( "%src/Security/%.ql " ) and
30- not getIdProperty ( t . getQLDoc ( ) ) .matches ( "% java/ android/%" ) and
31- importsAndroidModule ( t )
32- select t , "This Android query is missing the `android` prefix in its `@id`."
26+ d .getLocation ( ) .getFile ( ) .getRelativePath ( ) .matches ( "%src/Security/%" ) and
27+ not d . getQueryId ( ) .matches ( "android/%" ) and
28+ importsAndroidModule ( d . getParent ( ) )
29+ select d , "This Android query is missing the `android/ ` prefix in its `@id`."
You can’t perform that action at this time.
0 commit comments