Skip to content

Commit 97ebe0b

Browse files
committed
Sort --generate-rcfile output
1 parent 1579c43 commit 97ebe0b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

doc/whatsnew/fragments/7655.other

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Sort ``--generated-rcfile`` output.
2+
3+
Refs #7655

pylint/config/arguments_manager.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ def generate_config(
437437
)
438438
options_by_section = {}
439439
sections = []
440-
for group in self._arg_parser._action_groups:
440+
for group in sorted(
441+
self._arg_parser._action_groups,
442+
key=lambda x: (x.title != "Main", x.title),
443+
):
441444
group_name = group.title
442445
assert group_name
443446
if group_name in skipsections:
@@ -449,7 +452,7 @@ def generate_config(
449452
for i in group._group_actions
450453
if not isinstance(i, argparse._SubParsersAction)
451454
]
452-
for opt in option_actions:
455+
for opt in sorted(option_actions, key=lambda x: x.option_strings[0][2:]):
453456
if "--help" in opt.option_strings:
454457
continue
455458

0 commit comments

Comments
 (0)