Skip to content

Commit e068ecd

Browse files
committed
A3-1-5: simplify length calculation, adjust testcase
1 parent 808dd5f commit e068ecd

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
| test.cpp:58:5:58:11 | getB | The trivial member function getB is not defined in the class body of $@. | test.cpp:2:7:2:7 | A | A |
2-
| test.cpp:60:25:60:28 | d | The template member function d is not defined in the class body of $@. | test.cpp:2:7:2:7 | A | A |
3-
| test.cpp:62:5:62:8 | b | The trivial member function b is not defined in the class body of $@. | test.cpp:2:7:2:7 | A | A |
4-
| test.cpp:81:34:81:57 | complexCalculation | The template member function complexCalculation is not defined in the class body of $@. | test.cpp:64:29:64:29 | B<C> | B<C> |
5-
| test.cpp:97:47:97:53 | d | The template member function d is not defined in the class body of $@. | test.cpp:64:29:64:29 | B<C> | B<C> |
6-
| test.cpp:101:27:101:33 | b | The template member function b is not defined in the class body of $@. | test.cpp:64:29:64:29 | B<C> | B<C> |
7-
| test.cpp:106:27:106:36 | getB | The template member function getB is not defined in the class body of $@. | test.cpp:64:29:64:29 | B<C> | B<C> |
1+
| test.cpp:65:5:65:11 | getB | The trivial member function getB is not defined in the class body of $@. | test.cpp:2:7:2:7 | A | A |
2+
| test.cpp:67:25:67:28 | d | The template member function d is not defined in the class body of $@. | test.cpp:2:7:2:7 | A | A |
3+
| test.cpp:69:5:69:8 | b | The trivial member function b is not defined in the class body of $@. | test.cpp:2:7:2:7 | A | A |
4+
| test.cpp:88:34:88:57 | complexCalculation | The template member function complexCalculation is not defined in the class body of $@. | test.cpp:71:29:71:29 | B<C> | B<C> |
5+
| test.cpp:104:47:104:53 | d | The template member function d is not defined in the class body of $@. | test.cpp:71:29:71:29 | B<C> | B<C> |
6+
| test.cpp:108:27:108:33 | b | The template member function b is not defined in the class body of $@. | test.cpp:71:29:71:29 | B<C> | B<C> |
7+
| test.cpp:113:27:113:36 | getB | The template member function getB is not defined in the class body of $@. | test.cpp:71:29:71:29 | B<C> | B<C> |

cpp/autosar/test/rules/A3-1-5/test.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class A {
2828
return a;
2929
int result = gcd(b, (a % b));
3030
;
31+
;
32+
;
33+
;
34+
;
35+
;
36+
;
37+
;
3138
return result;
3239
}
3340

@@ -131,5 +138,12 @@ int FooBar::f1(int a, int b) { // COMPLIANT not a trivial function
131138
return a;
132139
int result = FooBar::f1(b, (a % b));
133140
;
141+
;
142+
;
143+
;
144+
;
145+
;
146+
;
147+
;
134148
}
135149
}

cpp/common/src/codingstandards/cpp/Class.qll

+1-3
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ class IntrospectedMemberFunction extends MemberFunction {
149149
}
150150

151151
predicate hasTrivialLength() {
152-
this.getBlock().getLastStmt().getLocation().getStartLine() -
153-
this.getBlock().getStmt(0).getLocation().getStartLine() <= 10 and
154-
not exists(this.getBlock().getStmt(_).getChildStmt())
152+
this.getBlock().getLocation().getEndLine() - this.getBlock().getLocation().getStartLine() <= 10
155153
}
156154

157155
predicate isSetter() {

0 commit comments

Comments
 (0)