improve files
and exclude
parameter handling
#12543
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
"Problem" description
So this is not a really big deal it just cost me a lot of time and will likely happen to someone else in the future.
I have a bit of a complex file structure due to imported libraries etc. and this led to the error.
File Structure
mypy.ini
It still tried to check the
config.json
andsample.json
.Error message
Solution
After a long search I found out that when using a
*
in the path it gets expanded here:mypy/mypy/config_parser.py
Lines 79 to 83 in 5d82d5b
And then the
*.json
files fall through the cracks here and do not get checked:mypy/mypy/find_sources.py
Lines 44 to 46 in 99b62b3
Proposed Solution
I thought I would fix that and wrote a unit test mocking the path expansion. Additionally, I added the filters again at the end when all the files are added. I do believe this should make it more stable in general and hopefully make adding files more predictable in the future.
Fixes #10377 #10820