Skip to content

Commit d7936d1

Browse files
committed
fixes
1 parent 0df6fee commit d7936d1

File tree

5 files changed

+196
-0
lines changed

5 files changed

+196
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
| test.cpp:37:1:37:39 | // int myFunction() { return myValue; } | This comment appears to contain commented-out code. |
2+
| test.cpp:39:1:39:45 | // int myFunction() const { return myValue; } | This comment appears to contain commented-out code. |
3+
| test.cpp:41:1:41:54 | // int myFunction() const noexcept { return myValue; } | This comment appears to contain commented-out code. |
4+
| test.cpp:43:1:43:18 | // #define MYMACRO | This comment appears to contain commented-out code. |
5+
| test.cpp:45:1:45:23 | // #include "include.h" | This comment appears to contain commented-out code. |
6+
| test.cpp:47:1:51:2 | /*\n#ifdef\nvoid myFunction();\n#endif\n*/ | This comment appears to contain commented-out code. |
7+
| test.cpp:59:1:59:24 | // #if(defined(MYMACRO)) | This comment appears to contain commented-out code. |
8+
| test.cpp:63:1:63:15 | // #pragma once | This comment appears to contain commented-out code. |
9+
| test.cpp:65:1:65:17 | // # pragma once | This comment appears to contain commented-out code. |
10+
| test.cpp:67:1:67:19 | /*#error"myerror"*/ | This comment appears to contain commented-out code. |
11+
| test.cpp:91:1:95:2 | /*\n#ifdef MYMACRO\n // ...\n#endif // #ifdef MYMACRO\n*/ | This comment appears to contain commented-out code. |
12+
| test.cpp:106:21:106:43 | // #include "config2.h" | This comment appears to contain commented-out code. |
13+
| test.cpp:112:16:112:35 | /* #ifdef MYMACRO */ | This comment appears to contain commented-out code. |
14+
| test.cpp:116:1:116:24 | // commented_out_code(); | This comment appears to contain commented-out code. |
15+
| test.cpp:119:2:119:25 | // commented_out_code(); | This comment appears to contain commented-out code. |
16+
| test.cpp:122:1:122:22 | // commented out code; | This comment appears to contain commented-out code. |
17+
| test.cpp:124:1:127:8 | // some; | This comment appears to contain commented-out code. |
18+
| test.cpp:129:1:133:8 | // also; | This comment appears to contain commented-out code. |
19+
| test.cpp:141:1:146:2 | /*\n some;\n commented;\n out;\n code;\n*/ | This comment appears to contain commented-out code. |
20+
| test.cpp:148:1:154:2 | /*\n also;\n this\n is;\n commented-out\n code;\n*/ | This comment appears to contain commented-out code. |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// GENERATED FILE - DO NOT MODIFY
2+
import codingstandards.cpp.rules.sectionsofcodeshallnotbecommentedout.SectionsOfCodeShallNotBeCommentedOut

c/common/test/rules/sectionsofcodeshallnotbecommentedout/config.h

Whitespace-only changes.
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
3+
/*
4+
* This sentence contains a semicolon;
5+
* however, this doesn't make it code.
6+
*/
7+
8+
// This sentence contains a semicolon;
9+
// however, this doesn't make it code.
10+
11+
/* Mention a ';' */
12+
13+
/* Mention a '{' */
14+
15+
/* JSON example: {"foo":"bar"} */
16+
17+
/* JSON example in backticks: `{"foo":"bar"}` */
18+
19+
/* JSON example in quotes: '{"foo":"bar"}' */
20+
21+
/*
22+
* Code example: `return 0;`.
23+
*/
24+
25+
// Code example:
26+
//
27+
// return 0;
28+
29+
// Code example:
30+
//
31+
// ```
32+
// return 0;
33+
// ```
34+
35+
// { 1, 2, 3, 4 }
36+
37+
// Example: { 1, 2, 3, 4 }
38+
39+
// int myFunction() { return myValue; }
40+
41+
// int myFunction() const { return myValue; }
42+
43+
// int myFunction() const noexcept { return myValue; }
44+
45+
// #define MYMACRO
46+
47+
// #include "include.h"
48+
49+
/*
50+
#ifdef
51+
void myFunction();
52+
#endif
53+
*/
54+
55+
// define some constants
56+
57+
// don't #include anything here
58+
59+
// #hashtag
60+
61+
// #if(defined(MYMACRO))
62+
63+
// #iffy
64+
65+
// #pragma once
66+
67+
// # pragma once
68+
69+
/*#error"myerror"*/
70+
71+
#ifdef MYMACRO
72+
73+
// ...
74+
75+
#endif // #ifdef MYMACRO
76+
77+
#if !defined(MYMACRO)
78+
79+
// ...
80+
81+
#else // #if !defined(MYMACRO)
82+
83+
// ...
84+
85+
#endif // #else #if !defined(MYMACRO)
86+
87+
#ifdef MYMACRO
88+
89+
// ...
90+
91+
#endif // #ifdef MYMACRO (comment)
92+
93+
/*
94+
#ifdef MYMACRO
95+
// ...
96+
#endif // #ifdef MYMACRO
97+
*/
98+
99+
#ifdef MYMACRO1
100+
#ifdef MYMACRO2
101+
102+
// ...
103+
104+
// comment at end of block
105+
#endif // #ifdef MYMACRO2
106+
#endif // #ifdef MYMACRO1
107+
108+
#include "config.h" // #include "config2.h"
109+
110+
#ifdef MYMACRO
111+
112+
// ...
113+
114+
#error "error" /* #ifdef MYMACRO */
115+
116+
#endif /* #ifdef MYMACRO */
117+
118+
// commented_out_code();
119+
120+
#if 0
121+
// commented_out_code();
122+
#endif
123+
124+
// commented out code;
125+
126+
// some;
127+
// commented;
128+
// out;
129+
// code;
130+
131+
// also;
132+
// this
133+
// is;
134+
// commented-out
135+
// code;
136+
137+
// this
138+
// is;
139+
// not
140+
// commented-out;
141+
// code
142+
143+
/*
144+
some;
145+
commented;
146+
out;
147+
code;
148+
*/
149+
150+
/*
151+
also;
152+
this
153+
is;
154+
commented-out
155+
code;
156+
*/
157+
158+
/*
159+
this
160+
is;
161+
not
162+
commented-out;
163+
code
164+
*/
165+
166+
/*
167+
* documentation;
168+
* not;
169+
* commented;
170+
* out;
171+
* code;
172+
*/

cpp/common/test/rules/sectionsofcodeshallnotbecommentedout/test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C TEST CASE AND
2+
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
13
/*
24
* This sentence contains a semicolon;
35
* however, this doesn't make it code.

0 commit comments

Comments
 (0)