Method: pylint.checkers.base.name_checker.naming_style._create_naming_options
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
tuple (1)
1def _create_naming_options() -> Options:
2 name_options: list[tuple[str, OptionDict]] = []
3 for name_type in sorted(KNOWN_NAME_TYPES):
4 human_readable_name = constants.HUMAN_READABLE_TYPES[name_type]
5 name_type_hyphened = name_type.replace("_", "-")
6
7 help_msg = f"Regular expression matching correct {human_readable_name} names. "
8 if name_type in KNOWN_NAME_TYPES_WITH_STYLE:
9 help_msg += f"Overrides {name_type_hyphened}-naming-style. "
10 help_msg += f"If left empty, {human_readable_name} names will be checked with the set naming style."
11
12 # Add style option for names that support it
13 if name_type in KNOWN_NAME_TYPES_WITH_STYLE:
14 default_style = DEFAULT_NAMING_STYLES[name_type]
15 name_options.append(
16 (
17 f"{name_type_hyphened}-naming-style",
18 {
19 "default": default_style,
20 "type": "choice",
21 "choices": list(NAMING_STYLES.keys()),
22 "metavar": "<style>",
23 "help": f"Naming style matching correct {human_readable_name} names.",
24 },
25 )
26 )
27
28 name_options.append(
29 (
30 f"{name_type_hyphened}-rgx",
31 {
32 "default": None,
33 "type": "regexp",
34 "metavar": "<regexp>",
35 "help": help_msg,
36 },
37 )
38 )
39 return tuple(name_options)