pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.33k stars 1.14k forks source link

Pylint doesn't detect AttributeError when using PyQt5 #2555

Open apoullet opened 6 years ago

apoullet commented 6 years ago

Steps to reproduce

  1. Create a new directory and initiate a virtual environment in that directory using virtualenv
  2. Install pylint and PyQt5 using the venv's pip
  3. Create an rcfile for pylint (using pylint --generate-rcfile) and add PyQt5 to the extension-pkg-whitelist
  4. Write some code in python requesting an attribute that doesn't exist e.g.
import sys

from PyQt5 import QtWidgets

def create_window():
    app = QtWidgets.QApplication(sys.argv)
    window = QtWidgets.QWidget()
    window.definitely_not_one_of_its_attributes()
    window.show()

create_window()

Current behavior

When running pylint on the file it informs me that my code has been rated at 6.67/10.0 and that other than some missing docstrings there are no errors.

Expected behavior

Pylint should tell me that 'definitely_not_one_of_its_attributes' isn't an attribute of QWidget, which is the error message that I get when I try to run the code.

pylint --version output

pylint 2.1.1 astroid 2.0.4 Python 3.7.0 (default, Aug 22 2018, 15:22:33) [Clang 9.1.0 (clang-902.0.39.2)]

PCManticore commented 6 years ago

Thanks, will check why we don't emit for this.