@@ -58,7 +58,6 @@ def _get_all_options(linter: PyLinter) -> OptionsDataDict:
5858 """Get all options registered to a linter and return the data."""
5959 all_options : OptionsDataDict = defaultdict (list )
6060 for checker in sorted (linter .get_checkers ()):
61- checker_name = checker .name
6261 for option_name , option_info in checker .options :
6362 changes_to_do = DYNAMICALLY_DEFINED_OPTIONS .get (option_name , {})
6463 if changes_to_do :
@@ -68,7 +67,7 @@ def _get_all_options(linter: PyLinter) -> OptionsDataDict:
6867 f"{ new_value !r} (instead of { option_info [key_to_change ]!r} )"
6968 )
7069 option_info [key_to_change ] = new_value
71- all_options [checker_name ].append (
70+ all_options [checker . name ].append (
7271 OptionsData (
7372 option_name ,
7473 option_info ,
@@ -179,12 +178,17 @@ def _write_options_page(options: OptionsDataDict, linter: PyLinter) -> None:
179178 get_rst_title ("Standard Checkers" , "^" ),
180179 ]
181180 found_extensions = False
182-
183- for checker , checker_options in sorted (options .items ()):
181+ # We can't sort without using a key because if keys are checkers
182+ # then it's impossible to have a checker with the same name spanning
183+ # various class, and it would make pylint plugin code less readable
184+ # by forcing to use a single class / file
185+ for checker_name , checker_options in sorted (
186+ options .items (), key = lambda x : x [1 ][0 ].checker
187+ ):
184188 if not found_extensions and checker_options [0 ].extension :
185189 sections .append (get_rst_title ("Extensions" , "^" ))
186190 found_extensions = True
187- sections .append (_create_checker_section (checker , checker_options , linter ))
191+ sections .append (_create_checker_section (checker_name , checker_options , linter ))
188192
189193 sections_string = "\n \n " .join (sections )
190194 all_options_path = PYLINT_USERGUIDE_PATH / "configuration" / "all-options.rst"
0 commit comments