|
10 | 10 | from typing import NamedTuple
|
11 | 11 |
|
12 | 12 |
|
| 13 | +class Intention(enum.Enum): |
| 14 | + KEEP = "Keep the same behavior" |
| 15 | + USE_DEFAULT = "Use the new default behavior" |
| 16 | + # This could/should always be automated |
| 17 | + FIX_CONF = "Fix the configuration to become consistent again" |
| 18 | + |
| 19 | + |
13 | 20 | class BreakingChange(enum.Enum):
|
14 | 21 | MESSAGE_MADE_DISABLED_BY_DEFAULT = "{symbol} ({msgid}) was disabled by default"
|
15 | 22 | MESSAGE_MADE_ENABLED_BY_DEFAULT = "{symbol} ({msgid}) was enabled by default"
|
@@ -56,13 +63,14 @@ class Solution(enum.Enum):
|
56 | 63 | )
|
57 | 64 | REMOVE_OPTION = "Remove {option} from configuration"
|
58 | 65 | REVIEW_OPTION = "Review and adjust or remove {option}: {description}"
|
| 66 | + DO_NOTHING = "Do nothing" |
59 | 67 |
|
60 | 68 |
|
61 | 69 | ConditionsToBeAffected = list[Condition]
|
62 | 70 | # A solution to a breaking change might imply multiple actions
|
63 | 71 | MultipleActionSolution = list[Solution]
|
64 | 72 | # Sometimes there's multiple solutions and the user needs to choose
|
65 |
| -Solutions = list[MultipleActionSolution] |
| 73 | +Solutions = dict[Intention, MultipleActionSolution] |
66 | 74 | BreakingChangeWithSolution = tuple[
|
67 | 75 | BreakingChange, Information, ConditionsToBeAffected, Solutions
|
68 | 76 | ]
|
@@ -101,35 +109,53 @@ class Solution(enum.Enum):
|
101 | 109 | BreakingChange.MESSAGE_MOVED_TO_EXTENSION,
|
102 | 110 | NO_SELF_USE,
|
103 | 111 | [Condition.MESSAGE_IS_ENABLED, Condition.EXTENSION_IS_NOT_LOADED],
|
104 |
| - [[Solution.ADD_EXTENSION], [Solution.DISABLE_MESSAGE_IMPLICITLY]], |
| 112 | + { |
| 113 | + Intention.KEEP: [Solution.ADD_EXTENSION], |
| 114 | + Intention.USE_DEFAULT: [Solution.DISABLE_MESSAGE_IMPLICITLY], |
| 115 | + }, |
105 | 116 | ),
|
106 | 117 | ],
|
107 | 118 | "3.0.0": [
|
108 | 119 | (
|
109 | 120 | BreakingChange.EXTENSION_REMOVED,
|
110 | 121 | COMPARE_TO_ZERO,
|
111 | 122 | [Condition.MESSAGE_IS_NOT_DISABLED, Condition.EXTENSION_IS_LOADED],
|
112 |
| - [[Solution.REMOVE_EXTENSION, Solution.ENABLE_MESSAGE_EXPLICITLY]], |
| 123 | + { |
| 124 | + Intention.FIX_CONF: [ |
| 125 | + Solution.REMOVE_EXTENSION, |
| 126 | + Solution.ENABLE_MESSAGE_EXPLICITLY, |
| 127 | + ], |
| 128 | + }, |
113 | 129 | ),
|
114 | 130 | (
|
115 | 131 | BreakingChange.EXTENSION_REMOVED,
|
116 | 132 | COMPARE_TO_EMPTY_STRING,
|
117 | 133 | [Condition.MESSAGE_IS_NOT_DISABLED, Condition.EXTENSION_IS_LOADED],
|
118 |
| - [[Solution.REMOVE_EXTENSION, Solution.ENABLE_MESSAGE_EXPLICITLY]], |
| 134 | + { |
| 135 | + Intention.FIX_CONF: [ |
| 136 | + Solution.REMOVE_EXTENSION, |
| 137 | + Solution.ENABLE_MESSAGE_EXPLICITLY, |
| 138 | + ], |
| 139 | + }, |
119 | 140 | ),
|
120 | 141 | ],
|
121 | 142 | "4.0.0": [
|
122 | 143 | (
|
123 | 144 | BreakingChange.OPTION_REMOVED,
|
124 | 145 | SUGGESTION_MODE_REMOVED,
|
125 | 146 | [Condition.OPTION_IS_PRESENT],
|
126 |
| - [[Solution.REMOVE_OPTION]], |
| 147 | + { |
| 148 | + Intention.FIX_CONF: [Solution.REMOVE_OPTION], |
| 149 | + }, |
127 | 150 | ),
|
128 | 151 | (
|
129 | 152 | BreakingChange.OPTION_BEHAVIOR_CHANGED,
|
130 | 153 | INVALID_NAME_CONST_BEHAVIOR,
|
131 | 154 | [],
|
132 |
| - [[Solution.REVIEW_OPTION]], |
| 155 | + { |
| 156 | + Intention.KEEP: [Solution.REVIEW_OPTION], |
| 157 | + Intention.USE_DEFAULT: [Solution.DO_NOTHING], |
| 158 | + }, |
133 | 159 | ),
|
134 | 160 | ],
|
135 | 161 | }
|
0 commit comments