@@ -616,6 +616,85 @@ before opening a new Pull Request:
616616 Set the default app to Strawberry Perl. By default the executable is
617617 installed at ``C:\Strawberry\perl\bin\perl.exe ``.
618618
619+ KeepSorted Check
620+ ^^^^^^^^^^^^^^^^
621+
622+ The KeepSorted check ensures that specified blocks of code, configuration, or
623+ documentation remain in sorted order.
624+
625+ To use the KeepSorted check, wrap your sorted content with marker comments:
626+
627+ .. code-block :: c
628+
629+ // zephyr-keep-sorted-start
630+ option_a
631+ option_b
632+ option_c
633+ // zephyr-keep-sorted-stop
634+
635+ KeepSorted Marker Options
636+ """""""""""""""""""""""""
637+
638+ The ``zephyr-keep-sorted-start `` marker supports several optional parameters to
639+ customize the sorting behavior:
640+
641+ **re(regex_pattern) **
642+ Enables regex mode where only lines matching the specified regular expression
643+ are checked for sorting. Other lines are ignored.
644+
645+ Example checking sorted properties in a yaml file:
646+
647+ .. code-block :: yaml
648+
649+ # zephyr-keep-sorted-start re(^\s+\- name:)
650+ projects :
651+ - name : application
652+ revision : main
653+ - name : library1
654+ revision : feature-branch
655+ - name : library2
656+ revision : main
657+ # zephyr-keep-sorted-stop
658+
659+ **strip(characters) **
660+ Strips the specified characters from lines before performing the sort comparison.
661+ This is useful when lines have optional prefixes or suffixes that should be
662+ ignored during sorting.
663+
664+ Example stripping quotes from yaml dictionary keys:
665+
666+ .. code-block :: yaml
667+
668+ # zephyr-keep-sorted-start strip(":)
669+ ACPI :
670+ status : odd fixes
671+ " West project: acpica " :
672+ status : odd fixes
673+ # zephyr-keep-sorted-stop
674+
675+ **nofold **
676+ Disables line folding. By default, indented lines following a main line are
677+ concatenated (folded) together for sorting comparison. The ``nofold `` option
678+ disables this behavior and ignores indented lines.
679+
680+ **ignorecase **
681+ Enables case-insensitive sorting using Python's
682+ `casefold https://docs.python.org/3/library/stdtypes.html#str.casefold `_. This allows
683+ mixing uppercase and lowercase items in sorted blocks without causing sort
684+ order violations.
685+
686+ Multiple options can be combined on the same marker line:
687+
688+ .. code-block :: rst
689+
690+ .. zephyr-keep-sorted-start re(^\* \w) ignorecase
691+ * Shell
692+ Some important message about the shell.
693+
694+ * STM32
695+ Updates for this vendor.
696+ .. zephyr-keep-sorted-stop
697+
619698 twister
620699-------
621700
0 commit comments