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()) }
2828 */
2929predicate isAlias ( Predicate pred ) { exists ( pred .( ClasslessPredicate ) .getAlias ( ) ) }
3030
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+
3143from Predicate pred
3244where
3345 isGetPredicate ( pred ) and
3446 not hasReturnType ( pred ) and
3547 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 11| test.qll:4:11:4:18 | ClasslessPredicate getValue | This predicate starts with 'get' but does not return a value. |
22| 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