lookup test for "does not match signature of the base method in ..."
I've just seen a few warnings by Pycharm about
"Signature of method ... does not match signature of the base method ..."
e.g. closeEvent, changeEvent, moveEvent
a warning is not an error. I think we should lookup those and try to use the origin signature. When it is wanted as it is, we should flag them.
This can give a hint for an API change of our dependencies.
What linter does pycharm use to generate these warnings? Can we incorporate it into our lint workflow?
unfortunantely it looks like this one is built-in.
collected informations by perplexity. https://www.perplexity.ai/search/how-does-pycharm-do-the-test-f-XDcwnYHfR3KTtG0K.ATO2w#1
PyCharm does not use a specific linter to check for the Liskov Substitution Principle (LSP). Instead, PyCharm's built-in code inspection and analysis tools perform signature matching and type checking to help identify potential violations of LSP.
Hi @ReimarBauer ,
I believe the issue is a method signature mismatch in changeEvent. The parameter should have a defined type, like this:
def changeEvent(self, event: QEvent):
Pycharm suggests a signature change to
def closeEvent(self, event, **kwargs)
because of QWidget.__init__,
def __init__(self, parent, QWidget=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
pass
Qwidget.QMainWindow
def __init__(self, parent, QWidget=None, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
pass
the issue here about is find a way like pycharm does to find those problems and keep them fixed.
Of course we can follow the advice of Pycharm and clear these warnings. I am not sure if we easily can do have a test.