Skip to content

Commit c74a0f2

Browse files
[refactor] Inline the information used only once
1 parent 6ce6032 commit c74a0f2

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

pylint/config/_breaking_changes.py

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from __future__ import annotations
88

99
import enum
10+
import textwrap
1011
from typing import NamedTuple
1112

1213

@@ -78,31 +79,6 @@ class Solution(enum.Enum):
7879
NO_SELF_USE = Information(
7980
msgid_or_symbol="no-self-use", extension="pylint.extensions.no_self_use"
8081
)
81-
COMPARE_TO_ZERO = Information(
82-
msgid_or_symbol="compare-to-zero", extension="pylint.extensions.comparetozero"
83-
)
84-
COMPARE_TO_EMPTY_STRING = Information(
85-
msgid_or_symbol="compare-to-empty-string",
86-
extension="pylint.extensions.emptystring",
87-
)
88-
89-
SUGGESTION_MODE_REMOVED = Information(
90-
option="suggestion-mode",
91-
description="This option is no longer used and should be removed",
92-
)
93-
94-
INVALID_NAME_CONST_BEHAVIOR = Information(
95-
option=["const-rgx", "const-naming-style"],
96-
description="""\
97-
In 'invalid-name', module-level constants that are reassigned are now treated
98-
as variables and checked against ``--variable-rgx`` rather than ``--const-rgx``.
99-
Module-level lists, sets, and objects can pass against either regex.
100-
101-
You may need to adjust this option to match your naming conventions.
102-
103-
See the release notes for concrete examples: https://pylint.readthedocs.io/en/stable/whatsnew/4/4.0/index.html""",
104-
)
105-
10682
CONFIGURATION_BREAKING_CHANGES: dict[str, list[BreakingChangeWithSolution]] = {
10783
"2.14.0": [
10884
(
@@ -118,7 +94,10 @@ class Solution(enum.Enum):
11894
"3.0.0": [
11995
(
12096
BreakingChange.EXTENSION_REMOVED,
121-
COMPARE_TO_ZERO,
97+
Information(
98+
msgid_or_symbol="compare-to-zero",
99+
extension="pylint.extensions.comparetozero",
100+
),
122101
[Condition.MESSAGE_IS_NOT_DISABLED, Condition.EXTENSION_IS_LOADED],
123102
{
124103
Intention.FIX_CONF: [
@@ -129,7 +108,10 @@ class Solution(enum.Enum):
129108
),
130109
(
131110
BreakingChange.EXTENSION_REMOVED,
132-
COMPARE_TO_EMPTY_STRING,
111+
Information(
112+
msgid_or_symbol="compare-to-empty-string",
113+
extension="pylint.extensions.emptystring",
114+
),
133115
[Condition.MESSAGE_IS_NOT_DISABLED, Condition.EXTENSION_IS_LOADED],
134116
{
135117
Intention.FIX_CONF: [
@@ -142,15 +124,31 @@ class Solution(enum.Enum):
142124
"4.0.0": [
143125
(
144126
BreakingChange.OPTION_REMOVED,
145-
SUGGESTION_MODE_REMOVED,
127+
Information(
128+
option="suggestion-mode",
129+
description="This option is no longer used and should be removed",
130+
),
146131
[Condition.OPTION_IS_PRESENT],
147132
{
148133
Intention.FIX_CONF: [Solution.REMOVE_OPTION],
149134
},
150135
),
151136
(
152137
BreakingChange.OPTION_BEHAVIOR_CHANGED,
153-
INVALID_NAME_CONST_BEHAVIOR,
138+
Information(
139+
option=["const-rgx", "const-naming-style"],
140+
description=textwrap.dedent(
141+
"""
142+
In 'invalid-name', module-level constants that are reassigned are now treated
143+
as variables and checked against ``--variable-rgx`` rather than ``--const-rgx``.
144+
Module-level lists, sets, and objects can pass against either regex.
145+
146+
You may need to adjust this option to match your naming conventions.
147+
148+
See the release notes for concrete examples:
149+
https://pylint.readthedocs.io/en/stable/whatsnew/4/4.0/index.html""",
150+
),
151+
),
154152
[],
155153
{
156154
Intention.KEEP: [Solution.REVIEW_OPTION],

0 commit comments

Comments
 (0)