Skip to content

Refactor the message handling to use a smaller data structure #5607

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

Open
Pierre-Sassoulas opened this issue Dec 28, 2021 · 2 comments
Open
Assignees
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow Minor 💅 Polishing pylint is always nice performance

Comments

@Pierre-Sassoulas
Copy link
Member

Current problem

The message store use message definition, which are big data structure only required when we need to create the messages or explains the message. This is minor as it's probably a small performance gain. Also, we dynamically check and generate the data structure from our code which is always the same for a version.

Desired solution

We could use the msgid internally and simplify the code (and even improve performance). A translation from symbol to msgid when a symbol is used need to be done upfront. We could use typing to enforce that as msgid are string starting with a char betwee E W C or R and then 4 to 5 digits. , We could also generate an optimized data structure for Pylint's own message and only check the message for user plugin and extension.

Additional context

#5606 #5605

@Pierre-Sassoulas Pierre-Sassoulas added Minor 💅 Polishing pylint is always nice performance Maintenance Discussion or action around maintaining pylint or the dev workflow labels Dec 28, 2021
@cdce8p
Copy link
Member

cdce8p commented Dec 29, 2021

Worth remembering that the msgid might not be unique. AFAIK we don't enforce it currently. (It might not even be practical with custom plugins.)

@Pierre-Sassoulas
Copy link
Member Author

Pierre-Sassoulas commented Dec 29, 2021

The msgid (C0111) and associated symbol (missing-docstring) are unique by definition, or it means that the same msgid refer to different checks/warning, which would be very problematic. It's also checked at run time right now (in the MessageIdStore) for both pylint's code, loaded extensions and user extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow Minor 💅 Polishing pylint is always nice performance
Projects
None yet
Development

No branches or pull requests

2 participants