Skip to content

Commit 2c0ccf4

Browse files
committed
CPP: Exclude unusual header files such as config.h.
1 parent f381768 commit 2c0ccf4

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

cpp/ql/src/Documentation/CommentedOutCode.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ class CommentBlock extends Comment {
156156

157157
predicate isCommentedOutCode() {
158158
not this.isDocumentation() and
159+
not this.getFile().(HeaderFile).noTopLevelCode() and
159160
this.numCodeLines().(float) / this.numLines().(float) > 0.5
160161
}
161162

cpp/ql/test/query-tests/Documentation/CommentedOutCode/CommentedOutCode.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
| config.h:9:1:9:18 | //#define SETTING3 | This comment appears to contain commented-out code |
2-
| config.h:12:1:12:22 | /* #define SETTING4 */ | This comment appears to contain commented-out code |
3-
| config.h:19:1:19:21 | /* #undef SETTING5 */ | This comment appears to contain commented-out code |
41
| test2.cpp:37:1:37:39 | // int myFunction() { return myValue; } | This comment appears to contain commented-out code |
52
| test2.cpp:39:1:39:45 | // int myFunction() const { return myValue; } | This comment appears to contain commented-out code |
63
| test2.cpp:41:1:41:54 | // int myFunction() const noexcept { return myValue; } | This comment appears to contain commented-out code |

0 commit comments

Comments
 (0)