Skip to content

Commit d4adaa5

Browse files
committed
Augment A2-7-3
Remove testing of lambdas completely by removing the `and not ...` part.
1 parent c1dac08 commit d4adaa5

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

cpp/autosar/src/rules/A2-7-3/UndocumentedUserDefinedType.ql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ class DocumentableDeclaration extends Declaration {
3636
// Exclude instantiated template functions, which cannot reasonably be documented.
3737
not this.(Function).isFromTemplateInstantiation(_) and
3838
// Exclude anonymous lambda functions.
39-
not exists(LambdaExpression lc |
40-
lc.getLambdaFunction() = this and not lc.getEnclosingElement() instanceof Initializer
41-
)
39+
not exists(LambdaExpression lc | lc.getLambdaFunction() = this)
4240
or
4341
this instanceof MemberVariable and
4442
declarationType = "member variable" and

cpp/autosar/test/rules/A2-7-3/UndocumentedUserDefinedType.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
| test.cpp:78:6:78:6 | declaration of d | Declaration entry for function d is missing documentation. |
77
| test.cpp:81:6:81:6 | definition of e | Declaration entry for function e is missing documentation. |
88
| test.cpp:88:1:88:30 | definition of message_to_string_undocumented | Declaration entry for function message_to_string_undocumented is missing documentation. |
9-
| test.cpp:113:14:113:14 | definition of operator() | Declaration entry for function operator() is missing documentation. |
109
| test.cpp:160:21:160:24 | definition of kBar | Declaration entry for member variable kBar is missing documentation. |

cpp/autosar/test/rules/A2-7-3/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ std::string template_function_test() { // COMPLIANT
110110

111111
/// @brief function assigned_lambda_test.
112112
int assigned_lambda_test() {
113-
auto l = [](int x, int y) { return x + y; }; // NON_COMPLIANT
113+
auto l = [](int x, int y) { return x + y; }; // COMPLIANT: We exclude lambdas.
114114
return l(2, 3);
115115
}
116116

@@ -160,4 +160,4 @@ template <typename T> class A2_7_3 final {
160160
const std::string kBar{"bar"}; // NON_COMPLIANT
161161
};
162162
/// @brief This is the instantiateA2_7_3 documentation
163-
void instantiateA2_7_3() { A2_7_3<int> instance; }
163+
void instantiateA2_7_3() { A2_7_3<int> instance; }

0 commit comments

Comments
 (0)