63 text = textwrap.dedent(
65 #### Changes in existing checks
67 - Improved {doc}`bugprone-easily-swappable-parameters
68 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
69 correcting a spelling mistake on its option
70 `NamePrefixSuffixSilenceDissimilarityTreshold`.
72 - Improved {doc}`bugprone-exception-escape
73 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
74 exceptions from captures are now diagnosed, exceptions in the bodies of
75 lambdas that aren't actually invoked are not.
77 - Improved {doc}`bugprone-easily-swappable-parameters
78 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
79 correcting a spelling mistake on its option
80 `NamePrefixSuffixSilenceDissimilarityTreshold`.
84 lines = text.splitlines(
True)
85 report = _mod._emit_duplicate_report(lines,
"Changes in existing checks")
86 self.assertIsNotNone(report)
87 report_str = cast(str, report)
89 expected_report = textwrap.dedent(
91 Error: Duplicate entries in 'Changes in existing checks'.
93 Please merge these entries into a single bullet point.
95 -- Duplicate: - Improved {doc}`bugprone-easily-swappable-parameters
98 - Improved {doc}`bugprone-easily-swappable-parameters
99 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
100 correcting a spelling mistake on its option
101 `NamePrefixSuffixSilenceDissimilarityTreshold`.
104 - Improved {doc}`bugprone-easily-swappable-parameters
105 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
106 correcting a spelling mistake on its option
107 `NamePrefixSuffixSilenceDissimilarityTreshold`.
111 self.assertEqual(report_str, expected_report)
115 rn_text = textwrap.dedent(
119 - New {doc}`readability-redundant-parentheses
120 <clang-tidy/checks/readability/redundant-parentheses>` check.
122 Detect redundant parentheses.
124 - New {doc}`bugprone-derived-method-shadowing-base-method
125 <clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
127 Finds derived class methods that shadow a (non-virtual) base class method.
131 with tempfile.TemporaryDirectory()
as td:
132 rn_doc = os.path.join(td,
"ReleaseNotes.md")
133 out_path = os.path.join(td,
"out.md")
134 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
138 with redirect_stderr(buf):
139 rc = _mod.process_release_notes(out_path, rn_doc)
141 self.assertEqual(rc, 0)
142 with open(out_path,
"r", encoding=
"utf-8")
as f:
145 expected_out = textwrap.dedent(
149 - New {doc}`bugprone-derived-method-shadowing-base-method
150 <clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
152 Finds derived class methods that shadow a (non-virtual) base class method.
154 - New {doc}`readability-redundant-parentheses
155 <clang-tidy/checks/readability/redundant-parentheses>` check.
157 Detect redundant parentheses.
162 self.assertEqual(out, expected_out)
163 self.assertIn(
"not alphabetically sorted", buf.getvalue())
167 rn_text = textwrap.dedent(
169 #### Changes in existing checks
171 - Improved {doc}`bugprone-easily-swappable-parameters
172 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
173 correcting a spelling mistake on its option
174 `NamePrefixSuffixSilenceDissimilarityTreshold`.
176 - Improved {doc}`bugprone-exception-escape
177 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
178 exceptions from captures are now diagnosed, exceptions in the bodies of
179 lambdas that aren't actually invoked are not.
181 - Improved {doc}`bugprone-easily-swappable-parameters
182 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
183 correcting a spelling mistake on its option
184 `NamePrefixSuffixSilenceDissimilarityTreshold`.
188 with tempfile.TemporaryDirectory()
as td:
189 rn_doc = os.path.join(td,
"ReleaseNotes.md")
190 out_path = os.path.join(td,
"out.md")
191 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
195 with redirect_stderr(buf):
196 rc = _mod.process_release_notes(out_path, rn_doc)
197 self.assertEqual(rc, 0)
199 "Entries in 'clang-tools-extra/docs/ReleaseNotes.md' are not alphabetically sorted.",
203 with open(out_path,
"r", encoding=
"utf-8")
as f:
205 expected_out = textwrap.dedent(
207 #### Changes in existing checks
209 - Improved {doc}`bugprone-easily-swappable-parameters
210 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
211 correcting a spelling mistake on its option
212 `NamePrefixSuffixSilenceDissimilarityTreshold`.
214 - Improved {doc}`bugprone-easily-swappable-parameters
215 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
216 correcting a spelling mistake on its option
217 `NamePrefixSuffixSilenceDissimilarityTreshold`.
219 - Improved {doc}`bugprone-exception-escape
220 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
221 exceptions from captures are now diagnosed, exceptions in the bodies of
222 lambdas that aren't actually invoked are not.
226 self.assertEqual(out, expected_out)
230 rn_text = textwrap.dedent(
232 #### Changes in existing checks
234 - Improved {doc}`bugprone-easily-swappable-parameters
235 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
236 correcting a spelling mistake on its option
237 `NamePrefixSuffixSilenceDissimilarityTreshold`.
239 - Improved {doc}`bugprone-easily-swappable-parameters
240 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
241 correcting a spelling mistake on its option
242 `NamePrefixSuffixSilenceDissimilarityTreshold`.
244 - Improved {doc}`bugprone-exception-escape
245 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
246 exceptions from captures are now diagnosed, exceptions in the bodies of
247 lambdas that aren't actually invoked are not.
251 with tempfile.TemporaryDirectory()
as td:
252 rn_doc = os.path.join(td,
"ReleaseNotes.md")
253 out_path = os.path.join(td,
"out.md")
254 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
258 with redirect_stderr(buf):
259 rc = _mod.process_release_notes(out_path, rn_doc)
261 self.assertEqual(rc, 3)
262 expected_report = textwrap.dedent(
264 Error: Duplicate entries in 'Changes in existing checks'.
266 Please merge these entries into a single bullet point.
268 -- Duplicate: - Improved {doc}`bugprone-easily-swappable-parameters
271 - Improved {doc}`bugprone-easily-swappable-parameters
272 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
273 correcting a spelling mistake on its option
274 `NamePrefixSuffixSilenceDissimilarityTreshold`.
277 - Improved {doc}`bugprone-easily-swappable-parameters
278 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
279 correcting a spelling mistake on its option
280 `NamePrefixSuffixSilenceDissimilarityTreshold`.
284 self.assertEqual(buf.getvalue(), expected_report)
286 with open(out_path,
"r", encoding=
"utf-8")
as f:
288 self.assertEqual(out, rn_text)
393 list_text = textwrap.dedent(
395 | Name | Redirect | Offers fixes |
397 | {doc}`cert-dcl16-c <cert/dcl16-c>` | {doc}`readability-uppercase-literal-suffix <readability/uppercase-literal-suffix>` | Yes |
398 | {doc}`cert-con36-c <cert/con36-c>` | {doc}`bugprone-spuriously-wake-up-functions <bugprone/spuriously-wake-up-functions>` | |
399 | {doc}`cert-dcl37-c <cert/dcl37-c>` | {doc}`bugprone-reserved-identifier <bugprone/reserved-identifier>` | Yes |
400 | {doc}`cert-arr39-c <cert/arr39-c>` | {doc}`bugprone-sizeof-expression <bugprone/sizeof-expression>` | |
403 with tempfile.TemporaryDirectory()
as td:
404 in_doc = os.path.join(td,
"list.md")
405 out_doc = os.path.join(td,
"out.md")
406 with open(in_doc,
"w", encoding=
"utf-8")
as f:
409 with redirect_stderr(buf):
410 rc = _mod.process_checks_list(out_doc, in_doc)
411 self.assertEqual(rc, 0)
413 "Checks in 'clang-tools-extra/docs/clang-tidy/checks/list.md' tables are not alphabetically sorted.",
416 self.assertEqual(rc, 0)
417 with open(out_doc,
"r", encoding=
"utf-8")
as f:
420 expected_out = textwrap.dedent(
422 | Name | Redirect | Offers fixes |
424 | {doc}`cert-arr39-c <cert/arr39-c>` | {doc}`bugprone-sizeof-expression <bugprone/sizeof-expression>` | |
425 | {doc}`cert-con36-c <cert/con36-c>` | {doc}`bugprone-spuriously-wake-up-functions <bugprone/spuriously-wake-up-functions>` | |
426 | {doc}`cert-dcl16-c <cert/dcl16-c>` | {doc}`readability-uppercase-literal-suffix <readability/uppercase-literal-suffix>` | Yes |
427 | {doc}`cert-dcl37-c <cert/dcl37-c>` | {doc}`bugprone-reserved-identifier <bugprone/reserved-identifier>` | Yes |
430 self.assertEqual(out, expected_out)