Expand description
Checks that a list of items is in alphabetical order
Use the following marker in the code:
// tidy-alphabetical-start
fn aaa() {}
fn eee() {}
fn z() {}
// tidy-alphabetical-endEmpty lines and lines starting (ignoring spaces) with // or # (except those starting with
#!) are considered comments are are sorted together with the next line (but do not affect
sorting).
If the following lines have higher indentation we effectively join them with the current line
before comparing it. If the next line with the same indentation starts (ignoring spaces) with
a closing delimiter (), [, }) it is joined as well.
E.g.
โ
foo(a,
b);
bar(
a,
b
);
// are treated for sorting purposes as
foo(a, b);
bar(a, b);Constantsยง
- END_
MARKER ๐ - START_
MARKER ๐
Functionsยง
- check
- check_
lines ๐ - consume_
numeric_ ๐prefix - indentation ๐
- is_
close_ ๐bracket - is_
empty_ ๐or_ comment - sort_
section ๐ - Given contents of a section that is enclosed between
START_MARKERandEND_MARKER, sorts them according to the rules described at the top of the module. - sub_
find ๐ - Finds
patins[range]and returns a range such thats[ret] == pat. - version_
sort ๐