Skip to content

Errors not shown when target file has absolute path #14080

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

Closed
dunaden001 opened this issue Nov 13, 2022 · 3 comments
Closed

Errors not shown when target file has absolute path #14080

dunaden001 opened this issue Nov 13, 2022 · 3 comments

Comments

@dunaden001
Copy link

Bug Report
mypy seems to be ignoring at least some errors when called on a file using an absolute address. I had originally presumed this was an issue with my project but it's very easy for me to reproduce on a basic setup. If you have reason to believe this an issue with my machine setup, I would love to know - I'm currently unable to use mypy linting in vscode due to this issue.

$ .venv/bin/mypy --strict /home/mike/Documents/deleteMe/pipenv_testing/sample.py 
Success: no issues found in 1 source file

$ .venv/bin/mypy --strict ./sample.py 
sample.py:4: error: Function is missing a type annotation  [no-untyped-def]
Found 1 error in 1 file (checked 1 source file)

To Reproduce

  1. Generate a file containing one or more simple mypy errors, example below (error only occurs with strict set on):
# sample.py
def do_a_thing(invar):
    return invar + 1
  1. Install mypy (I'm using pipenv to generate a virtualenv using pipenv install mypy)
  2. Run mypy against a relative path to the simple python file generated above in a configuration that expects an error and verify the error is displayed correctly. For example: .venv/bin/mypy --strict ./sample.py
  3. Repeat step 3 but use an absolute path to the target python file and observe that no issues are reported. For example: .venv/bin/mypy --strict /home/mike/Documents/deleteMe/pipenv_testing/sample.py

Expected Behavior
It's expected that both conditions should yield identical error results rather than the absolute path call yielding no issues/errors.

Your Environment

  • Mypy version: mypy 0.990 (compiled: yes)
  • Python version: Python 3.9.15
  • Mypy command-line flags: '--strict'
  • No form of mypy configuration file used anywhere (though I also performed the same tests with a project containing a config file that I specified with an absolute file path using the '--config-file' arg and got the same results).
@AlexWaygood
Copy link
Member

Duplicate of #14042

@AlexWaygood AlexWaygood marked this as a duplicate of #14042 Nov 13, 2022
@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2022
@AlexWaygood
Copy link
Member

It's already fixed on master; a patch release with the fix should be coming soon :)

@dunaden001
Copy link
Author

Perfect - thank you for the quick response! (and sorry i didn't find the duplicate)

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

No branches or pull requests

2 participants