Author: mitchell Date: 2025-12-24T16:05:58+08:00 New Revision: d2af817ecd6943dff2deea99b68bf16ada9dd953
URL: https://github.com/llvm/llvm-project/commit/d2af817ecd6943dff2deea99b68bf16ada9dd953 DIFF: https://github.com/llvm/llvm-project/commit/d2af817ecd6943dff2deea99b68bf16ada9dd953.diff LOG: [clang-tidy] Give clear instruction when duplicates are detected in `check_alphabetical_order.py` (#173465) As of AI usage: Gemini 3 is used to generate the new instruction. Related discussion: https://github.com/llvm/llvm-project/pull/173448#discussion_r2644988250 Added: Modified: clang-tools-extra/clang-tidy/tool/check_alphabetical_order.py clang-tools-extra/clang-tidy/tool/check_alphabetical_order_test.py Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/tool/check_alphabetical_order.py b/clang-tools-extra/clang-tidy/tool/check_alphabetical_order.py index 66819aba435e8..6a200e36b2715 100644 --- a/clang-tools-extra/clang-tidy/tool/check_alphabetical_order.py +++ b/clang-tools-extra/clang-tidy/tool/check_alphabetical_order.py @@ -352,7 +352,8 @@ def _emit_duplicate_report(lines: Sequence[str], title: str) -> Optional[str]: if not (dups_detail := find_duplicate_entries(lines, title)): return None out: List[str] = [] - out.append(f"Error: Duplicate entries in '{title}':\n") + out.append(f"Error: Duplicate entries in '{title}'.\n") + out.append("\nPlease merge these entries into a single bullet point.\n") for key, occs in dups_detail: out.append(f"\n-- Duplicate: {key}\n") for start_idx, block in occs: diff --git a/clang-tools-extra/clang-tidy/tool/check_alphabetical_order_test.py b/clang-tools-extra/clang-tidy/tool/check_alphabetical_order_test.py index 48a3c761c12ce..fa418e41ee8a8 100644 --- a/clang-tools-extra/clang-tidy/tool/check_alphabetical_order_test.py +++ b/clang-tools-extra/clang-tidy/tool/check_alphabetical_order_test.py @@ -92,7 +92,9 @@ def test_duplicate_detection_and_report(self) -> None: expected_report = textwrap.dedent( """\ - Error: Duplicate entries in 'Changes in existing checks': + Error: Duplicate entries in 'Changes in existing checks'. + + Please merge these entries into a single bullet point. -- Duplicate: - Improved :doc:`bugprone-easily-swappable-parameters @@ -269,7 +271,9 @@ def test_process_release_notes_with_duplicates_fails(self) -> None: self.assertEqual(rc, 3) expected_report = textwrap.dedent( """\ - Error: Duplicate entries in 'Changes in existing checks': + Error: Duplicate entries in 'Changes in existing checks'. + + Please merge these entries into a single bullet point. -- Duplicate: - Improved :doc:`bugprone-easily-swappable-parameters _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
