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 Please merge these entries into a single bullet point.
99 -- Duplicate: - Improved :doc:`bugprone-easily-swappable-parameters
102 - Improved :doc:`bugprone-easily-swappable-parameters
103 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
104 correcting a spelling mistake on its option
105 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
108 - Improved :doc:`bugprone-easily-swappable-parameters
109 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
110 correcting a spelling mistake on its option
111 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
114 self.assertEqual(report_str, expected_report)
118 rn_text = textwrap.dedent(
123 - New :doc:`readability-redundant-parentheses
124 <clang-tidy/checks/readability/redundant-parentheses>` check.
126 Detect redundant parentheses.
128 - New :doc:`bugprone-derived-method-shadowing-base-method
129 <clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
131 Finds derived class methods that shadow a (non-virtual) base class method.
135 with tempfile.TemporaryDirectory()
as td:
136 rn_doc = os.path.join(td,
"ReleaseNotes.rst")
137 out_path = os.path.join(td,
"out.rst")
138 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
142 with redirect_stderr(buf):
143 rc = _mod.process_release_notes(out_path, rn_doc)
145 self.assertEqual(rc, 0)
146 with open(out_path,
"r", encoding=
"utf-8")
as f:
149 expected_out = textwrap.dedent(
154 - New :doc:`bugprone-derived-method-shadowing-base-method
155 <clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
157 Finds derived class methods that shadow a (non-virtual) base class method.
159 - New :doc:`readability-redundant-parentheses
160 <clang-tidy/checks/readability/redundant-parentheses>` check.
162 Detect redundant parentheses.
168 self.assertEqual(out, expected_out)
169 self.assertIn(
"not alphabetically sorted", buf.getvalue())
173 rn_text = textwrap.dedent(
175 Changes in existing checks
176 ^^^^^^^^^^^^^^^^^^^^^^^^^^
178 - Improved :doc:`bugprone-easily-swappable-parameters
179 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
180 correcting a spelling mistake on its option
181 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
183 - Improved :doc:`bugprone-exception-escape
184 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
185 exceptions from captures are now diagnosed, exceptions in the bodies of
186 lambdas that aren't actually invoked are not.
188 - Improved :doc:`bugprone-easily-swappable-parameters
189 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
190 correcting a spelling mistake on its option
191 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
195 with tempfile.TemporaryDirectory()
as td:
196 rn_doc = os.path.join(td,
"ReleaseNotes.rst")
197 out_path = os.path.join(td,
"out.rst")
198 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
202 with redirect_stderr(buf):
203 rc = _mod.process_release_notes(out_path, rn_doc)
204 self.assertEqual(rc, 0)
206 "Entries in 'clang-tools-extra/docs/ReleaseNotes.rst' are not alphabetically sorted.",
210 with open(out_path,
"r", encoding=
"utf-8")
as f:
212 expected_out = textwrap.dedent(
214 Changes in existing checks
215 ^^^^^^^^^^^^^^^^^^^^^^^^^^
217 - Improved :doc:`bugprone-easily-swappable-parameters
218 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
219 correcting a spelling mistake on its option
220 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
222 - Improved :doc:`bugprone-easily-swappable-parameters
223 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
224 correcting a spelling mistake on its option
225 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
227 - Improved :doc:`bugprone-exception-escape
228 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
229 exceptions from captures are now diagnosed, exceptions in the bodies of
230 lambdas that aren't actually invoked are not.
235 self.assertEqual(out, expected_out)
239 rn_text = textwrap.dedent(
241 Changes in existing checks
242 ^^^^^^^^^^^^^^^^^^^^^^^^^^
244 - Improved :doc:`bugprone-easily-swappable-parameters
245 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
246 correcting a spelling mistake on its option
247 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
249 - Improved :doc:`bugprone-easily-swappable-parameters
250 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
251 correcting a spelling mistake on its option
252 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
254 - Improved :doc:`bugprone-exception-escape
255 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
256 exceptions from captures are now diagnosed, exceptions in the bodies of
257 lambdas that aren't actually invoked are not.
261 with tempfile.TemporaryDirectory()
as td:
262 rn_doc = os.path.join(td,
"ReleaseNotes.rst")
263 out_path = os.path.join(td,
"out.rst")
264 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
268 with redirect_stderr(buf):
269 rc = _mod.process_release_notes(out_path, rn_doc)
271 self.assertEqual(rc, 3)
272 expected_report = textwrap.dedent(
274 Error: Duplicate entries in 'Changes in existing checks'.
276 Please merge these entries into a single bullet point.
278 -- Duplicate: - Improved :doc:`bugprone-easily-swappable-parameters
281 - Improved :doc:`bugprone-easily-swappable-parameters
282 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
283 correcting a spelling mistake on its option
284 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
287 - Improved :doc:`bugprone-easily-swappable-parameters
288 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
289 correcting a spelling mistake on its option
290 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
294 self.assertEqual(buf.getvalue(), expected_report)
296 with open(out_path,
"r", encoding=
"utf-8")
as f:
298 self.assertEqual(out, rn_text)
301 rn_text = textwrap.dedent(
303 Changes in existing checks
304 ^^^^^^^^^^^^^^^^^^^^^^^^^^
306 - Improved :doc:`bugprone-easily-swappable-parameters
307 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
308 correcting a spelling mistake on its option
309 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
311 - Improved :doc:`llvm-prefer-isa-or-dyn-cast-in-conditionals
312 <clang-tidy/checks/llvm/prefer-isa-or-dyn-cast-in-conditionals>` check:
314 - Fix-it handles callees with nested-name-specifier correctly.
316 - ``if`` statements with init-statement (``if (auto X = ...; ...)``) are
319 - ``for`` loops are supported.
321 - Improved :doc:`bugprone-exception-escape
322 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
323 exceptions from captures are now diagnosed, exceptions in the bodies of
324 lambdas that aren't actually invoked are not.
329 out = _mod.normalize_release_notes(rn_text.splitlines(
True))
331 expected_out = textwrap.dedent(
333 Changes in existing checks
334 ^^^^^^^^^^^^^^^^^^^^^^^^^^
336 - Improved :doc:`bugprone-easily-swappable-parameters
337 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
338 correcting a spelling mistake on its option
339 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
341 - Improved :doc:`bugprone-exception-escape
342 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
343 exceptions from captures are now diagnosed, exceptions in the bodies of
344 lambdas that aren't actually invoked are not.
346 - Improved :doc:`llvm-prefer-isa-or-dyn-cast-in-conditionals
347 <clang-tidy/checks/llvm/prefer-isa-or-dyn-cast-in-conditionals>` check:
349 - Fix-it handles callees with nested-name-specifier correctly.
351 - ``if`` statements with init-statement (``if (auto X = ...; ...)``) are
354 - ``for`` loops are supported.
359 self.assertEqual(out, expected_out)
362 list_text = textwrap.dedent(
365 :header: "Name", "Redirect", "Offers fixes"
367 :doc:`cert-dcl16-c <cert/dcl16-c>`, :doc:`readability-uppercase-literal-suffix <readability/uppercase-literal-suffix>`, "Yes"
368 :doc:`cert-con36-c <cert/con36-c>`, :doc:`bugprone-spuriously-wake-up-functions <bugprone/spuriously-wake-up-functions>`,
369 :doc:`cert-dcl37-c <cert/dcl37-c>`, :doc:`bugprone-reserved-identifier <bugprone/reserved-identifier>`, "Yes"
370 :doc:`cert-arr39-c <cert/arr39-c>`, :doc:`bugprone-sizeof-expression <bugprone/sizeof-expression>`,
373 with tempfile.TemporaryDirectory()
as td:
374 in_doc = os.path.join(td,
"list.rst")
375 out_doc = os.path.join(td,
"out.rst")
376 with open(in_doc,
"w", encoding=
"utf-8")
as f:
379 with redirect_stderr(buf):
380 rc = _mod.process_checks_list(out_doc, in_doc)
381 self.assertEqual(rc, 0)
383 "Checks in 'clang-tools-extra/docs/clang-tidy/checks/list.rst' csv-table are not alphabetically sorted.",
386 self.assertEqual(rc, 0)
387 with open(out_doc,
"r", encoding=
"utf-8")
as f:
390 expected_out = textwrap.dedent(
393 :header: "Name", "Redirect", "Offers fixes"
395 :doc:`cert-arr39-c <cert/arr39-c>`, :doc:`bugprone-sizeof-expression <bugprone/sizeof-expression>`,
396 :doc:`cert-con36-c <cert/con36-c>`, :doc:`bugprone-spuriously-wake-up-functions <bugprone/spuriously-wake-up-functions>`,
397 :doc:`cert-dcl16-c <cert/dcl16-c>`, :doc:`readability-uppercase-literal-suffix <readability/uppercase-literal-suffix>`, "Yes"
398 :doc:`cert-dcl37-c <cert/dcl37-c>`, :doc:`bugprone-reserved-identifier <bugprone/reserved-identifier>`, "Yes"
401 self.assertEqual(out, expected_out)