66 text = textwrap.dedent(
68 Changes in existing checks
69 ^^^^^^^^^^^^^^^^^^^^^^^^^^
71 - Improved :doc:`bugprone-easily-swappable-parameters
72 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
73 correcting a spelling mistake on its option
74 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
76 - Improved :doc:`bugprone-exception-escape
77 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
78 exceptions from captures are now diagnosed, exceptions in the bodies of
79 lambdas that aren't actually invoked are not.
81 - Improved :doc:`bugprone-easily-swappable-parameters
82 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
83 correcting a spelling mistake on its option
84 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
88 lines = text.splitlines(
True)
89 report = _mod._emit_duplicate_report(lines,
"Changes in existing checks")
90 self.assertIsNotNone(report)
91 report_str = cast(str, report)
93 expected_report = textwrap.dedent(
95 Error: Duplicate entries in 'Changes in existing checks':
97 -- Duplicate: - Improved :doc:`bugprone-easily-swappable-parameters
100 - Improved :doc:`bugprone-easily-swappable-parameters
101 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
102 correcting a spelling mistake on its option
103 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
106 - Improved :doc:`bugprone-easily-swappable-parameters
107 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
108 correcting a spelling mistake on its option
109 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
112 self.assertEqual(report_str, expected_report)
116 rn_text = textwrap.dedent(
121 - New :doc:`readability-redundant-parentheses
122 <clang-tidy/checks/readability/redundant-parentheses>` check.
124 Detect redundant parentheses.
126 - New :doc:`bugprone-derived-method-shadowing-base-method
127 <clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
129 Finds derived class methods that shadow a (non-virtual) base class method.
133 with tempfile.TemporaryDirectory()
as td:
134 rn_doc = os.path.join(td,
"ReleaseNotes.rst")
135 out_path = os.path.join(td,
"out.rst")
136 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
140 with redirect_stderr(buf):
141 rc = _mod.process_release_notes(out_path, rn_doc)
143 self.assertEqual(rc, 0)
144 with open(out_path,
"r", encoding=
"utf-8")
as f:
147 expected_out = textwrap.dedent(
152 - New :doc:`bugprone-derived-method-shadowing-base-method
153 <clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
155 Finds derived class methods that shadow a (non-virtual) base class method.
157 - New :doc:`readability-redundant-parentheses
158 <clang-tidy/checks/readability/redundant-parentheses>` check.
160 Detect redundant parentheses.
166 self.assertEqual(out, expected_out)
167 self.assertIn(
"not alphabetically sorted", buf.getvalue())
171 rn_text = textwrap.dedent(
173 Changes in existing checks
174 ^^^^^^^^^^^^^^^^^^^^^^^^^^
176 - Improved :doc:`bugprone-easily-swappable-parameters
177 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
178 correcting a spelling mistake on its option
179 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
181 - Improved :doc:`bugprone-exception-escape
182 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
183 exceptions from captures are now diagnosed, exceptions in the bodies of
184 lambdas that aren't actually invoked are not.
186 - Improved :doc:`bugprone-easily-swappable-parameters
187 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
188 correcting a spelling mistake on its option
189 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
193 with tempfile.TemporaryDirectory()
as td:
194 rn_doc = os.path.join(td,
"ReleaseNotes.rst")
195 out_path = os.path.join(td,
"out.rst")
196 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
200 with redirect_stderr(buf):
201 rc = _mod.process_release_notes(out_path, rn_doc)
202 self.assertEqual(rc, 0)
204 "Entries in 'clang-tools-extra/docs/ReleaseNotes.rst' are not alphabetically sorted.",
208 with open(out_path,
"r", encoding=
"utf-8")
as f:
210 expected_out = textwrap.dedent(
212 Changes in existing checks
213 ^^^^^^^^^^^^^^^^^^^^^^^^^^
215 - Improved :doc:`bugprone-easily-swappable-parameters
216 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
217 correcting a spelling mistake on its option
218 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
220 - Improved :doc:`bugprone-easily-swappable-parameters
221 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
222 correcting a spelling mistake on its option
223 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
225 - Improved :doc:`bugprone-exception-escape
226 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
227 exceptions from captures are now diagnosed, exceptions in the bodies of
228 lambdas that aren't actually invoked are not.
233 self.assertEqual(out, expected_out)
237 rn_text = textwrap.dedent(
239 Changes in existing checks
240 ^^^^^^^^^^^^^^^^^^^^^^^^^^
242 - Improved :doc:`bugprone-easily-swappable-parameters
243 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
244 correcting a spelling mistake on its option
245 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
247 - Improved :doc:`bugprone-easily-swappable-parameters
248 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
249 correcting a spelling mistake on its option
250 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
252 - Improved :doc:`bugprone-exception-escape
253 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
254 exceptions from captures are now diagnosed, exceptions in the bodies of
255 lambdas that aren't actually invoked are not.
259 with tempfile.TemporaryDirectory()
as td:
260 rn_doc = os.path.join(td,
"ReleaseNotes.rst")
261 out_path = os.path.join(td,
"out.rst")
262 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
266 with redirect_stderr(buf):
267 rc = _mod.process_release_notes(out_path, rn_doc)
269 self.assertEqual(rc, 3)
270 expected_report = textwrap.dedent(
272 Error: Duplicate entries in 'Changes in existing checks':
274 -- Duplicate: - Improved :doc:`bugprone-easily-swappable-parameters
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``.
283 - Improved :doc:`bugprone-easily-swappable-parameters
284 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
285 correcting a spelling mistake on its option
286 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
290 self.assertEqual(buf.getvalue(), expected_report)
292 with open(out_path,
"r", encoding=
"utf-8")
as f:
294 self.assertEqual(out, rn_text)
297 rn_text = textwrap.dedent(
299 Changes in existing checks
300 ^^^^^^^^^^^^^^^^^^^^^^^^^^
302 - Improved :doc:`bugprone-easily-swappable-parameters
303 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
304 correcting a spelling mistake on its option
305 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
307 - Improved :doc:`llvm-prefer-isa-or-dyn-cast-in-conditionals
308 <clang-tidy/checks/llvm/prefer-isa-or-dyn-cast-in-conditionals>` check:
310 - Fix-it handles callees with nested-name-specifier correctly.
312 - ``if`` statements with init-statement (``if (auto X = ...; ...)``) are
315 - ``for`` loops are supported.
317 - Improved :doc:`bugprone-exception-escape
318 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
319 exceptions from captures are now diagnosed, exceptions in the bodies of
320 lambdas that aren't actually invoked are not.
325 out = _mod.normalize_release_notes(rn_text.splitlines(
True))
327 expected_out = textwrap.dedent(
329 Changes in existing checks
330 ^^^^^^^^^^^^^^^^^^^^^^^^^^
332 - Improved :doc:`bugprone-easily-swappable-parameters
333 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
334 correcting a spelling mistake on its option
335 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
337 - Improved :doc:`bugprone-exception-escape
338 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
339 exceptions from captures are now diagnosed, exceptions in the bodies of
340 lambdas that aren't actually invoked are not.
342 - Improved :doc:`llvm-prefer-isa-or-dyn-cast-in-conditionals
343 <clang-tidy/checks/llvm/prefer-isa-or-dyn-cast-in-conditionals>` check:
345 - Fix-it handles callees with nested-name-specifier correctly.
347 - ``if`` statements with init-statement (``if (auto X = ...; ...)``) are
350 - ``for`` loops are supported.
355 self.assertEqual(out, expected_out)
358 list_text = textwrap.dedent(
361 :header: "Name", "Redirect", "Offers fixes"
363 :doc:`cert-dcl16-c <cert/dcl16-c>`, :doc:`readability-uppercase-literal-suffix <readability/uppercase-literal-suffix>`, "Yes"
364 :doc:`cert-con36-c <cert/con36-c>`, :doc:`bugprone-spuriously-wake-up-functions <bugprone/spuriously-wake-up-functions>`,
365 :doc:`cert-dcl37-c <cert/dcl37-c>`, :doc:`bugprone-reserved-identifier <bugprone/reserved-identifier>`, "Yes"
366 :doc:`cert-arr39-c <cert/arr39-c>`, :doc:`bugprone-sizeof-expression <bugprone/sizeof-expression>`,
369 with tempfile.TemporaryDirectory()
as td:
370 in_doc = os.path.join(td,
"list.rst")
371 out_doc = os.path.join(td,
"out.rst")
372 with open(in_doc,
"w", encoding=
"utf-8")
as f:
375 with redirect_stderr(buf):
376 rc = _mod.process_checks_list(out_doc, in_doc)
377 self.assertEqual(rc, 0)
379 "Checks in 'clang-tools-extra/docs/clang-tidy/checks/list.rst' csv-table are not alphabetically sorted.",
382 self.assertEqual(rc, 0)
383 with open(out_doc,
"r", encoding=
"utf-8")
as f:
386 expected_out = textwrap.dedent(
389 :header: "Name", "Redirect", "Offers fixes"
391 :doc:`cert-arr39-c <cert/arr39-c>`, :doc:`bugprone-sizeof-expression <bugprone/sizeof-expression>`,
392 :doc:`cert-con36-c <cert/con36-c>`, :doc:`bugprone-spuriously-wake-up-functions <bugprone/spuriously-wake-up-functions>`,
393 :doc:`cert-dcl16-c <cert/dcl16-c>`, :doc:`readability-uppercase-literal-suffix <readability/uppercase-literal-suffix>`, "Yes"
394 :doc:`cert-dcl37-c <cert/dcl37-c>`, :doc:`bugprone-reserved-identifier <bugprone/reserved-identifier>`, "Yes"
397 self.assertEqual(out, expected_out)