Skip to content

Commit 802e6cd

Browse files
committed
Fix for A5-1-3 false positives
1 parent c5bf50b commit 802e6cd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Only consider lambdas that have zero arguments, since any lambda with non-zero arguments will have an explicit argument list.

cpp/autosar/src/rules/A5-1-3/LambdaExpressionWithoutParameterList.ql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ where
2121
not isExcluded(lambda, LambdasPackage::lambdaExpressionWithoutParameterListQuery()) and
2222
lambdaFunction = lambda.getLambdaFunction() and
2323
not lambdaFunction.isAffectedByMacro() and
24+
// If it has a parameter, then it will have an
25+
// explicit parameter list. Therefore, proceed to check only if the lambda
26+
// does not have any parameters.
27+
not exists (lambdaFunction.getAParameter()) and
2428
// The extractor doesn't store the syntactic information whether the parameter list
2529
// is enclosed in parenthesis. Therefore we cannot determine if the parameter list is
2630
// explicitly specified when the parameter list is empty.

0 commit comments

Comments
 (0)