Skip to content

Migrate remaining failure messages to mypy.messages #6116

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
chadrik opened this issue Dec 30, 2018 · 4 comments
Open

Migrate remaining failure messages to mypy.messages #6116

chadrik opened this issue Dec 30, 2018 · 4 comments
Labels
refactoring Changing mypy's internals topic-error-reporting How we report errors

Comments

@chadrik
Copy link
Contributor

chadrik commented Dec 30, 2018

I'm working on a tool to provide a more gradual mypy adoption path, by providing a fine grained configuration for selecting or ignoring mypy errors. My current prototype uses regular expressions, but maintaining a comprehensive set of regular expressions is both time consuming and brittle, as existing messages could change, and new ones will be added.

I noticed that an effort has already been made to move error messages from mypy.checkexpr into mypy.messages. Making this set of constants complete would solve my problem, and hopefully be of benefit to you all as well. Would you accept a pull request to migrate the remaining failure messages from checkexpr, semanal, semanal_newtype, and fastparse2 to messages constants?

@ilevkivskyi
Copy link
Member

I like this idea. Moreover, I like the idea of having more systematic way of working with error messages, like error codes, see #2417. For example, TypeScript implemented such systematics long ago.

@JukkaL had some concern about adding the error codes, but just migrating the errors messages to the same file could be a nice first step that will simplify further discussion.

Also I think it makes sense to systematize only errors/warnings, notes can be kept ad-hoc.

@chadrik
Copy link
Contributor Author

chadrik commented Dec 30, 2018

Great! I made a PR.

@JukkaL had some concern about adding the error codes, but just migrating the errors messages to the same file could be a nice first step that will simplify further discussion.

I made some comments in that issue.

Also I think it makes sense to systematize only errors/warnings, notes can be kept ad-hoc.

Agreed.

ilevkivskyi pushed a commit that referenced this issue Jan 4, 2019
…ker) (#6118)

Consolidate all mypy error messages into one place (`mypy.messages`).  This opens the door to some interesting features, such as adding language localization or a more systematic way of working with error messages, akin to error codes (#2417).  It also helps create more consistent messages.  e.g. it's now more apparent that there are a few outliers that use single quotes around type names.

I'm breaking this up change up into several PRs by module, this is the first and simplest.  Once all are complete, this will address #6116.
@JelleZijlstra JelleZijlstra added refactoring Changing mypy's internals topic-error-reporting How we report errors labels Mar 19, 2022
SaintLeonar added a commit to SaintLeonar/mypy that referenced this issue May 21, 2023
….py)

Consolidate .fail() messages into one place (`mypy.message_registry`).  This will address python#6116.
@SaintLeonar
Copy link

SaintLeonar commented May 29, 2023

Hello! I made this commit 14f1b5c to contribute to the issue. This is my first attempt at contributing on GitHub. Could someone provide me with some feedback on my solution?

@ilevkivskyi
Copy link
Member

@SaintLeonar you need to open a pull request. Btw I am not sure mypyc errors are the most important to migrate.

SaintLeonar added a commit to SaintLeonar/mypy that referenced this issue Jun 5, 2023
Migrate remaining failure messages to mypy.messages_registry (semanal_newtype.py). This will address python#6116
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Changing mypy's internals topic-error-reporting How we report errors
Projects
None yet
Development

No branches or pull requests

4 participants