Clazy warns with ctor-missing-parent-argument for subclasses of QCoreApplication, but the base class QCoreApplication has no constructor that takes a parent object. The Qt documentation explicitely mentions use cases for creating subclasses of QCoreApplication, for example to override QCoreApplication::notify(). Would it be difficult for Clazy to detect if the base class is QCoreApplication and suppress the warning in this case?
clazy shouldn't warn for any base class that lives in a system header, such as QCoreApplication
(In reply to Sergio Martins from comment #1) > clazy shouldn't warn for any base class that lives in a system header, such > as QCoreApplication sure, but I'm saying it should also not warn for the subclass. It doesn't make much sense to write a constructor with a parent argument for subclasses of QCoreApplication.
(In reply to Markus Enzenberger from comment #2) > (In reply to Sergio Martins from comment #1) > > clazy shouldn't warn for any base class that lives in a system header, such > > as QCoreApplication > > sure, but I'm saying it should also not warn for the subclass. It doesn't > make much sense to write a constructor with a parent argument for subclasses > of QCoreApplication. just to be explicit: I mean subclasses written by the user, not in Qt headers.
Git commit 641ef2cf56a5d8e64e43a46e01aee0efd354215a by Sergio Martins. Committed on 21/09/2017 at 15:04. Pushed by smartins into branch '1.2'. ctor-missing-parent-argument: Add a failing unit-test M +2 -1 tests/ctor-missing-parent-argument/config.json M +7 -0 tests/ctor-missing-parent-argument/main.cpp https://commits.kde.org/clazy/641ef2cf56a5d8e64e43a46e01aee0efd354215a
Git commit b843957a8dd3fc24ecdaae0289d976a08a0e6958 by Sergio Martins. Committed on 21/09/2017 at 21:42. Pushed by smartins into branch '1.2'. ctor-missing-parent-argument: Don't warn when base class is in system header and doesn't accept any QObject in any ctor. M +10 -0 src/checks/level1/ctor-missing-parent-argument.cpp M +1 -2 tests/ctor-missing-parent-argument/config.json https://commits.kde.org/clazy/b843957a8dd3fc24ecdaae0289d976a08a0e6958