Skip to content

Results from wrong file when files have the same name but different extensions #3631

Closed
pylint-dev/astroid
#2722
@BenjaminHamon

Description

@BenjaminHamon

Given two python files with the same name, one with the .py extension and another with any other extension (e.g. .wsgi), pylint always reports issues only from the file with the .py extension.

This may be working as intended (see invoking pylint with a file) but a warning of some kind would be useful.

The workaround is to not use files with the same name, regardless of the file extensions.

Steps to reproduce

  1. Create two files with only the extension being different (my_script.py, my_script.wsgi)
  2. Edit the files with each a different pylint issue (e.g. import-error and trailing-newlines)
  3. Run pylint on each file, or on both files at once
  4. Notice pylint always reports the issue from my_script.py

Current behavior

Pylint reports issues from the file with the .py extension.

Expected behavior

Pylint reports issues from the exact file passed as argument.

OR

Pylint warns about file name collision.

pylint --version output

Python 3.8 on Windows

pylint 2.5.2
astroid 2.4.1
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)]

Python 3.7 on Linux Debian

pylint 2.5.0
astroid 2.4.0
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement ✨Improvement to a componentNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions