From 59ff16045ae2965165b6f081347e79676bbba7dd Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sun, 5 Oct 2025 22:11:56 +0200 Subject: [PATCH 1/3] [breaking changes] Add intention behind a possible fix Refs #5462 --- pylint/config/_breaking_changes.py | 38 +++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/pylint/config/_breaking_changes.py b/pylint/config/_breaking_changes.py index c3fe03517c..64c5474184 100644 --- a/pylint/config/_breaking_changes.py +++ b/pylint/config/_breaking_changes.py @@ -10,6 +10,13 @@ from typing import NamedTuple +class Intention(enum.Enum): + KEEP = "Keep the same behavior" + USE_DEFAULT = "Use the new default behavior" + # This could/should always be automated + FIX_CONF = "Fix the configuration to become consistent again" + + class BreakingChange(enum.Enum): MESSAGE_MADE_DISABLED_BY_DEFAULT = "{symbol} ({msgid}) was disabled by default" MESSAGE_MADE_ENABLED_BY_DEFAULT = "{symbol} ({msgid}) was enabled by default" @@ -62,7 +69,7 @@ class Solution(enum.Enum): # A solution to a breaking change might imply multiple actions MultipleActionSolution = list[Solution] # Sometimes there's multiple solutions and the user needs to choose -Solutions = list[MultipleActionSolution] +Solutions = dict[Intention, MultipleActionSolution] BreakingChangeWithSolution = tuple[ BreakingChange, Information, ConditionsToBeAffected, Solutions ] @@ -101,7 +108,10 @@ class Solution(enum.Enum): BreakingChange.MESSAGE_MOVED_TO_EXTENSION, NO_SELF_USE, [Condition.MESSAGE_IS_ENABLED, Condition.EXTENSION_IS_NOT_LOADED], - [[Solution.ADD_EXTENSION], [Solution.DISABLE_MESSAGE_IMPLICITLY]], + { + Intention.KEEP: [Solution.ADD_EXTENSION], + Intention.USE_DEFAULT: [Solution.DISABLE_MESSAGE_IMPLICITLY], + }, ), ], "3.0.0": [ @@ -109,13 +119,23 @@ class Solution(enum.Enum): BreakingChange.EXTENSION_REMOVED, COMPARE_TO_ZERO, [Condition.MESSAGE_IS_NOT_DISABLED, Condition.EXTENSION_IS_LOADED], - [[Solution.REMOVE_EXTENSION, Solution.ENABLE_MESSAGE_EXPLICITLY]], + { + Intention.FIX_CONF: [ + Solution.REMOVE_EXTENSION, + Solution.ENABLE_MESSAGE_EXPLICITLY, + ], + }, ), ( BreakingChange.EXTENSION_REMOVED, COMPARE_TO_EMPTY_STRING, [Condition.MESSAGE_IS_NOT_DISABLED, Condition.EXTENSION_IS_LOADED], - [[Solution.REMOVE_EXTENSION, Solution.ENABLE_MESSAGE_EXPLICITLY]], + { + Intention.FIX_CONF: [ + Solution.REMOVE_EXTENSION, + Solution.ENABLE_MESSAGE_EXPLICITLY, + ], + }, ), ], "4.0.0": [ @@ -123,13 +143,19 @@ class Solution(enum.Enum): BreakingChange.OPTION_REMOVED, SUGGESTION_MODE_REMOVED, [Condition.OPTION_IS_PRESENT], - [[Solution.REMOVE_OPTION]], + { + Intention.FIX_CONF: [Solution.REMOVE_OPTION], + }, ), ( BreakingChange.OPTION_BEHAVIOR_CHANGED, INVALID_NAME_CONST_BEHAVIOR, [], - [[Solution.REVIEW_OPTION]], + { + Intention.KEEP: [Solution.REVIEW_OPTION], + Intention.USE_DEFAULT: [], + Intention.FIX_CONF: [], + }, ), ], } From 19cf711400fec31fbffcba3d4c68f6ef516cdbc0 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sun, 5 Oct 2025 22:22:11 +0200 Subject: [PATCH 2/3] if there's nothing to do to fix the conf then no need to be explicit --- pylint/config/_breaking_changes.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pylint/config/_breaking_changes.py b/pylint/config/_breaking_changes.py index 64c5474184..b5fff97c47 100644 --- a/pylint/config/_breaking_changes.py +++ b/pylint/config/_breaking_changes.py @@ -154,7 +154,6 @@ class Solution(enum.Enum): { Intention.KEEP: [Solution.REVIEW_OPTION], Intention.USE_DEFAULT: [], - Intention.FIX_CONF: [], }, ), ], From b250f6bef2db9828c6041b7e3130aba0215b67e5 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 6 Oct 2025 20:18:49 +0200 Subject: [PATCH 3/3] Add 'do nothing' solution --- pylint/config/_breaking_changes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pylint/config/_breaking_changes.py b/pylint/config/_breaking_changes.py index b5fff97c47..e17268294f 100644 --- a/pylint/config/_breaking_changes.py +++ b/pylint/config/_breaking_changes.py @@ -63,6 +63,7 @@ class Solution(enum.Enum): ) REMOVE_OPTION = "Remove {option} from configuration" REVIEW_OPTION = "Review and adjust or remove {option}: {description}" + DO_NOTHING = "Do nothing" ConditionsToBeAffected = list[Condition] @@ -153,7 +154,7 @@ class Solution(enum.Enum): [], { Intention.KEEP: [Solution.REVIEW_OPTION], - Intention.USE_DEFAULT: [], + Intention.USE_DEFAULT: [Solution.DO_NOTHING], }, ), ],