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``.
115 self.assertEqual(report_str, expected_report)
119 rn_text = textwrap.dedent(
124 - New :doc:`readability-redundant-parentheses
125 <clang-tidy/checks/readability/redundant-parentheses>` check.
127 Detect redundant parentheses.
129 - New :doc:`bugprone-derived-method-shadowing-base-method
130 <clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
132 Finds derived class methods that shadow a (non-virtual) base class method.
136 with tempfile.TemporaryDirectory()
as td:
137 rn_doc = os.path.join(td,
"ReleaseNotes.rst")
138 out_path = os.path.join(td,
"out.rst")
139 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
143 with redirect_stderr(buf):
144 rc = _mod.process_release_notes(out_path, rn_doc)
146 self.assertEqual(rc, 0)
147 with open(out_path,
"r", encoding=
"utf-8")
as f:
150 expected_out = textwrap.dedent(
155 - New :doc:`bugprone-derived-method-shadowing-base-method
156 <clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
158 Finds derived class methods that shadow a (non-virtual) base class method.
160 - New :doc:`readability-redundant-parentheses
161 <clang-tidy/checks/readability/redundant-parentheses>` check.
163 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.
234 self.assertEqual(out, expected_out)
238 rn_text = textwrap.dedent(
240 Changes in existing checks
241 ^^^^^^^^^^^^^^^^^^^^^^^^^^
243 - Improved :doc:`bugprone-easily-swappable-parameters
244 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
245 correcting a spelling mistake on its option
246 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
248 - Improved :doc:`bugprone-easily-swappable-parameters
249 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
250 correcting a spelling mistake on its option
251 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
253 - Improved :doc:`bugprone-exception-escape
254 <clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
255 exceptions from captures are now diagnosed, exceptions in the bodies of
256 lambdas that aren't actually invoked are not.
260 with tempfile.TemporaryDirectory()
as td:
261 rn_doc = os.path.join(td,
"ReleaseNotes.rst")
262 out_path = os.path.join(td,
"out.rst")
263 with open(rn_doc,
"w", encoding=
"utf-8")
as f:
267 with redirect_stderr(buf):
268 rc = _mod.process_release_notes(out_path, rn_doc)
270 self.assertEqual(rc, 3)
271 expected_report = textwrap.dedent(
273 Error: Duplicate entries in 'Changes in existing checks'.
275 Please merge these entries into a single bullet point.
277 -- Duplicate: - Improved :doc:`bugprone-easily-swappable-parameters
280 - Improved :doc:`bugprone-easily-swappable-parameters
281 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
282 correcting a spelling mistake on its option
283 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
286 - Improved :doc:`bugprone-easily-swappable-parameters
287 <clang-tidy/checks/bugprone/easily-swappable-parameters>` check by
288 correcting a spelling mistake on its option
289 ``NamePrefixSuffixSilenceDissimilarityTreshold``.
293 self.assertEqual(buf.getvalue(), expected_report)
295 with open(out_path,
"r", encoding=
"utf-8")
as f:
297 self.assertEqual(out, rn_text)
402 list_text = textwrap.dedent(
405 :header: "Name", "Redirect", "Offers fixes"
407 :doc:`cert-dcl16-c <cert/dcl16-c>`, :doc:`readability-uppercase-literal-suffix <readability/uppercase-literal-suffix>`, "Yes"
408 :doc:`cert-con36-c <cert/con36-c>`, :doc:`bugprone-spuriously-wake-up-functions <bugprone/spuriously-wake-up-functions>`,
409 :doc:`cert-dcl37-c <cert/dcl37-c>`, :doc:`bugprone-reserved-identifier <bugprone/reserved-identifier>`, "Yes"
410 :doc:`cert-arr39-c <cert/arr39-c>`, :doc:`bugprone-sizeof-expression <bugprone/sizeof-expression>`,
413 with tempfile.TemporaryDirectory()
as td:
414 in_doc = os.path.join(td,
"list.rst")
415 out_doc = os.path.join(td,
"out.rst")
416 with open(in_doc,
"w", encoding=
"utf-8")
as f:
419 with redirect_stderr(buf):
420 rc = _mod.process_checks_list(out_doc, in_doc)
421 self.assertEqual(rc, 0)
423 "Checks in 'clang-tools-extra/docs/clang-tidy/checks/list.rst' csv-table are not alphabetically sorted.",
426 self.assertEqual(rc, 0)
427 with open(out_doc,
"r", encoding=
"utf-8")
as f:
430 expected_out = textwrap.dedent(
433 :header: "Name", "Redirect", "Offers fixes"
435 :doc:`cert-arr39-c <cert/arr39-c>`, :doc:`bugprone-sizeof-expression <bugprone/sizeof-expression>`,
436 :doc:`cert-con36-c <cert/con36-c>`, :doc:`bugprone-spuriously-wake-up-functions <bugprone/spuriously-wake-up-functions>`,
437 :doc:`cert-dcl16-c <cert/dcl16-c>`, :doc:`readability-uppercase-literal-suffix <readability/uppercase-literal-suffix>`, "Yes"
438 :doc:`cert-dcl37-c <cert/dcl37-c>`, :doc:`bugprone-reserved-identifier <bugprone/reserved-identifier>`, "Yes"
441 self.assertEqual(out, expected_out)