Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[configuration] Create a data structure to store breaking changes #9088

Conversation

Pierre-Sassoulas
Copy link
Member

Type of Changes

Type
βœ“ πŸ“œ Docs

Description

First step for #5462 . I suppose considering the timeline early reviews are important πŸ˜„

@Pierre-Sassoulas Pierre-Sassoulas added Documentation πŸ“— Skip news πŸ”‡ This change does not require a changelog entry labels Oct 2, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.0.0b1 milestone Oct 2, 2023
Comment on lines 80 to 81
[Condition.MESSAGE_IS_NOT_DISABLED, Condition.EXTENSION_IS_NOT_LOADED],
[[Solution.ADD_EXTENSION], [Solution.DISABLE_MESSAGE_IMPLICITLY]],
Copy link
Member Author

@Pierre-Sassoulas Pierre-Sassoulas Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For something like this, it's hard to know if the upgrade was done the second time the script is run. (Maybe it's disabled implicitly voluntarily).

Suggested change
[Condition.MESSAGE_IS_NOT_DISABLED, Condition.EXTENSION_IS_NOT_LOADED],
[[Solution.ADD_EXTENSION], [Solution.DISABLE_MESSAGE_IMPLICITLY]],
[Condition.MESSAGE_IS_NOT_DISABLED, Condition.EXTENSION_IS_NOT_LOADED],
[[Solution.ADD_EXTENSION], [Solution.DISABLE_MESSAGE_EXPLICITLY]],

We might want another way to tell if the pylintrc need upgrading, like maybe a upgraded-to=3.0.0 option and keeping track of the target version in the data structure (i.e a dict[str, list[BreakingChangeWithSolution]] ``{"2.15.0": [no-self-use], "3.0.0": compare-to-zero compare-to-empty-string} and if upgraded-to=2.17.0 we do not check no-self-use anymore).

@codecov
Copy link

codecov bot commented Oct 2, 2023

Codecov Report

Merging #9088 (4ca0379) into main (0335711) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #9088   +/-   ##
=======================================
  Coverage   95.75%   95.75%           
=======================================
  Files         173      173           
  Lines       18663    18663           
=======================================
  Hits        17871    17871           
  Misses        792      792           

@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 3.0.0b1, 3.0.0 Oct 2, 2023
@github-actions

This comment has been minimized.

Copy link
Member

@jacobtylerwalls jacobtylerwalls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this a lot, just some Qs.

Comment on lines +24 to +27
MESSAGE_IS_ENABLED = "{symbol} ({msgid}) is enabled"
MESSAGE_IS_NOT_ENABLED = "{symbol} ({msgid}) is not enabled"
MESSAGE_IS_DISABLED = "{symbol} ({msgid}) is disabled"
MESSAGE_IS_NOT_DISABLED = "{symbol} ({msgid}) is not disabled"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering how these will work with ALL? Hopefully they won't, I guess. If there are low-quality messages we're moving to extensions, it would be a shame for people who have ALL enabled to then start explicitly enabling them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not think of all, but we definitely need to add data in the conf to be able to handle this case (#9088 (comment))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we move something to extension (like no-self-use) I was thinking the condition / solutions would be:

  [Condition.MESSAGE_IS_ENABLED, Condition.EXTENSION_IS_NOT_LOADED],
  [[Solution.ADD_EXTENSION], [Solution.DISABLE_MESSAGE_IMPLICITLY]],

So would all would be activated if the condition is MESSAGE_IS_ENABLED ? Can we even see the difference between enable=all or an explicit enable=no-self-use ? In any case if someone launch all following the upgrade we need to be able to not warn and we need an info that the pylintrc was upgraded to a certain version already.

pylint/config/_breaking_changes.py Show resolved Hide resolved
pylint/config/_breaking_changes.py Outdated Show resolved Hide resolved
msgid="R6301", symbol="no-self-use", extension="pylint.extensions.no_self_use"
)
COMPARE_TO_ZERO = Information(
msgid="C2001", symbol="compare-to-zero", extension="pylint.extensions.comparetozero"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when the message ids change? (as we do somewhat frequently)

Copy link
Member Author

@Pierre-Sassoulas Pierre-Sassoulas Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... We're going to have to check with the message store (we also need the message store if we want to upgrade the message names automatically later). We have all the msgid/symbol correspondence in the message store so there's a little duplication. But not the "old extensions" infos. I wonder if we should just use msgid_or_symbol and add the old_extensions info in the message dict from the checker...

Suggested change
msgid="C2001", symbol="compare-to-zero", extension="pylint.extensions.comparetozero"
msgid_or_symbol="C2001", extension="pylint.extensions.comparetozero"
Suggested change
msgid="C2001", symbol="compare-to-zero", extension="pylint.extensions.comparetozero"
msgid_or_symbol=""compare-to-zero"
#In the implicit_booleaness_checker .MSGS
...
old_extensions = ["pylint.extensions.comparetozero"]
...

@github-actions

This comment has been minimized.

@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 3.0.0, 3.0.1 Oct 2, 2023
@Pierre-Sassoulas Pierre-Sassoulas force-pushed the data-structure-for-breaking-changes-information branch from 899a644 to 2c75c33 Compare October 2, 2023 18:41
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 3.0.1, 3.1.0 Oct 2, 2023
Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after Jacob's concerns have been adressed. It is a bit hard to review this without seeing it being fully used, but splitting it off in smaller PRs is indeed nice!

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2023

πŸ€– According to the primer, this change has no effect on the checked open source code. πŸ€–πŸŽ‰

This comment was generated for commit 4ca0379

@Pierre-Sassoulas
Copy link
Member Author

Pierre-Sassoulas commented Oct 7, 2023

@jacobtylerwalls what do you think of the current state of the datastructure ? Should we merge as is ? I'm planning on adding what's necessary to be able to do breaking change in option values like #8411 next. It feels like we'd need to define a function specific for each in this case ("option for overgeneral exception does not contain a dot" ) I could also try to make something more generic in this MR directly.

@Pierre-Sassoulas Pierre-Sassoulas removed this from the 3.1.0 milestone Oct 12, 2023
@Pierre-Sassoulas Pierre-Sassoulas merged commit 3afa971 into pylint-dev:main Oct 12, 2023
42 checks passed
@Pierre-Sassoulas Pierre-Sassoulas deleted the data-structure-for-breaking-changes-information branch October 12, 2023 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation πŸ“— Skip news πŸ”‡ This change does not require a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants