File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
test/queries/style/ValidatePredicateGetReturns Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -28,9 +28,21 @@ predicate hasReturnType(Predicate pred) { exists(pred.getReturnType()) }
28
28
*/
29
29
predicate isAlias ( Predicate pred ) { exists ( pred .( ClasslessPredicate ) .getAlias ( ) ) }
30
30
31
+ /**
32
+ * Returns "get" if the predicate name starts with "get", otherwise "as".
33
+ */
34
+ string getPrefix ( Predicate pred ) {
35
+ if pred .getName ( ) .matches ( "get%" )
36
+ then result = "get"
37
+ else
38
+ if pred .getName ( ) .matches ( "as%" )
39
+ then result = "as"
40
+ else result = ""
41
+ }
42
+
31
43
from Predicate pred
32
44
where
33
45
isGetPredicate ( pred ) and
34
46
not hasReturnType ( pred ) and
35
47
not isAlias ( pred )
36
- select pred , "This predicate starts with 'get ' but does not return a value."
48
+ select pred , "This predicate starts with '" + getPrefix ( pred ) + " ' but does not return a value."
Original file line number Diff line number Diff line change 1
1
| test.qll:4:11:4:18 | ClasslessPredicate getValue | This predicate starts with 'get' but does not return a value. |
2
2
| test.qll:25:11:25:28 | ClasslessPredicate getImplementation2 | This predicate starts with 'get' but does not return a value. |
3
- | test.qll:31:11:31:17 | ClasslessPredicate asValue | This predicate starts with 'get ' but does not return a value. |
3
+ | test.qll:31:11:31:17 | ClasslessPredicate asValue | This predicate starts with 'as ' but does not return a value. |
You can’t perform that action at this time.
0 commit comments