mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Now the error message reflects properly the prefix
This commit is contained in:
@@ -28,9 +28,21 @@ predicate hasReturnType(Predicate pred) { exists(pred.getReturnType()) }
|
||||
*/
|
||||
predicate isAlias(Predicate pred) { exists(pred.(ClasslessPredicate).getAlias()) }
|
||||
|
||||
/**
|
||||
* Returns "get" if the predicate name starts with "get", otherwise "as".
|
||||
*/
|
||||
string getPrefix(Predicate pred) {
|
||||
if pred.getName().matches("get%")
|
||||
then result = "get"
|
||||
else
|
||||
if pred.getName().matches("as%")
|
||||
then result = "as"
|
||||
else result = ""
|
||||
}
|
||||
|
||||
from Predicate pred
|
||||
where
|
||||
isGetPredicate(pred) and
|
||||
not hasReturnType(pred) and
|
||||
not isAlias(pred)
|
||||
select pred, "This predicate starts with 'get' but does not return a value."
|
||||
select pred, "This predicate starts with '" + getPrefix(pred) + "' but does not return a value."
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
| test.qll:4:11:4:18 | ClasslessPredicate getValue | This predicate starts with 'get' but does not return a value. |
|
||||
| test.qll:25:11:25:28 | ClasslessPredicate getImplementation2 | This predicate starts with 'get' but does not return a value. |
|
||||
| test.qll:31:11:31:17 | ClasslessPredicate asValue | This predicate starts with 'get' but does not return a value. |
|
||||
| test.qll:31:11:31:17 | ClasslessPredicate asValue | This predicate starts with 'as' but does not return a value. |
|
||||
|
||||
Reference in New Issue
Block a user