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

Passing error_formatter in new_messages method of Error Class #18801

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Daksh2000
Copy link

Fixes: #18713

Problem -
When user runs dmypy for a file once (with flag output=json) , it gave correct validation error (in form of json)
But when user changes something in file and then runs the same command again , it does give error in json format because
since the daemon is running now , the code flow goes to print out errors without error_formatter set

Solution -
I passed formatter to new_messages of Errors Class (with default value None), so that when FineGrainedBuildManager is called again , it will have BuildManager associated with it and which will have the error_formatter set (if it was set intially while running daemon).

@Daksh2000
Copy link
Author

Fixes: #18713

Problem - When user runs dmypy for a file once (with flag output=json) , it gave correct validation error (in form of json) But when user changes something in file and then runs the same command again , it does give error in json format because since the daemon is running now , the code flow goes to print out errors without error_formatter set

Solution - I passed formatter to new_messages of Errors Class (with default value None), so that when FineGrainedBuildManager is called again , it will have BuildManager associated with it and which will have the error_formatter set (if it was set intially while running daemon).

@Daksh2000 Daksh2000 closed this Mar 13, 2025
@Daksh2000 Daksh2000 reopened this Mar 13, 2025
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dmypy only formats output in json the first time it's executed
2 participants