Skip to content

Commit

Permalink
Sort --generate-rcfile output
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Oct 21, 2022
1 parent 015f340 commit 843444d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/7655.other
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Sort ``--generated-rcfile`` output.

Refs #7655
7 changes: 5 additions & 2 deletions pylint/config/arguments_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,10 @@ def generate_config(
)
options_by_section = {}
sections = []
for group in self._arg_parser._action_groups:
for group in sorted(
self._arg_parser._action_groups,
key=lambda x: (x.title != "Main", x.title),
):
group_name = group.title
assert group_name
if group_name in skipsections:
Expand All @@ -459,7 +462,7 @@ def generate_config(
for i in group._group_actions
if not isinstance(i, argparse._SubParsersAction)
]
for opt in option_actions:
for opt in sorted(option_actions, key=lambda x: x.option_strings[0][2:]):
if "--help" in opt.option_strings:
continue

Expand Down

0 comments on commit 843444d

Please sign in to comment.