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 1
1
/**
2
2
* @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`.
4
4
* @kind problem
5
5
* @problem.severity warning
6
6
* @id ql/android-id-prefix
9
9
10
10
import ql
11
11
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. */
16
13
predicate importsAndroidModule ( TopLevel t ) {
17
14
exists ( Import i | t .getAnImport ( ) = i |
18
15
i .getImportString ( ) .toLowerCase ( ) .matches ( "%android%" )
@@ -24,9 +21,9 @@ predicate importsAndroidModule(TopLevel t) {
24
21
)
25
22
}
26
23
27
- from TopLevel t
24
+ from QueryDoc d
28
25
where
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