STEPS TO REPRODUCE 1. run clazy on a Qt5 project OBSERVED RESULT seen in the output: In file included from /home/build/Qt-com/5.15.9/gcc_64/include/QtPrintSupport/QtPrintSupport:3: /home/build/Qt-com/5.15.9/gcc_64/include/QtPrintSupport/QtPrintSupportDepends:3:10: error: Module QtCore should not be included directly [-Wclazy-no-module-include] #include <QtCore/QtCore> ^ /home/build/Qt-com/5.15.9/gcc_64/include/QtPrintSupport/QtPrintSupportDepends:4:10: error: Module QtGui should not be included directly [-Wclazy-no-module-include] #include <QtGui/QtGui> ^ /home/build/Qt-com/5.15.9/gcc_64/include/QtPrintSupport/QtPrintSupportDepends:5:10: error: Module QtWidgets should not be included directly [-Wclazy-no-module-include] #include <QtWidgets/QtWidgets> ^ 3 errors generated. EXPECTED RESULT how come those are "errors" and not "warnings"?
I can't reproduce this one, they are warnings in the test and I've check on another project and they are warnings too. By any chance, are you sure there is no settings to force warnings as errors in your project?
good idea. I'll set CLAZY_NO_WERROR to make sure
however, I don't think issues from inside Qt5 itself should be reported at all (unless the --qtdeveloper option is set
I think the issue here is that you include directly the module QtPrintSupport which, as other Qt modules, include all the modules and not the relevant classes (https://codebrowser.dev/qt5/qtbase/include/QtPrintSupport/QtPrintSupport.html). Wouldn't it be better to add it in the list of warnings to tell the user to directly use the relevant classes of QtPrintSupport (https://invent.kde.org/sdk/clazy/-/commit/b205b52c0efbee044fd9377e077cb73e8772c8f8#dd685b92c5cf09d7fb134070ca5b0febc6e8b8e3_0_40)?
(In reply to Jazeix Johnny from comment #4) > I think the issue here is that you include directly the module > QtPrintSupport which, as other Qt modules, include all the modules and not > the relevant classes > (https://codebrowser.dev/qt5/qtbase/include/QtPrintSupport/QtPrintSupport. > html). > > Wouldn't it be better to add it in the list of warnings to tell the user to > directly use the relevant classes of QtPrintSupport > (https://invent.kde.org/sdk/clazy/-/commit/ > b205b52c0efbee044fd9377e077cb73e8772c8f8#dd685b92c5cf09d7fb134070ca5b0febc6e8 > b8e3_0_40)? I've just checked and we already ignore when it's included from a Qt module, the issue is that I missed the QtPrintSupport module. I did it manually, I'm not sure if there is an automatic way to list of the Qt modules to ensure I didn't miss more
A possibly relevant merge request was started @ https://invent.kde.org/sdk/clazy/-/merge_requests/88
Git commit 2965bc3fca609f4a401709263f0d0fdcff8bf763 by Johnny Jazeix. Committed on 20/09/2023 at 20:50. Pushed by winterz into branch 'master'. add missing PrintSupport module for no-module-include check M +1 -1 src/checks/level0/no-module-include.cpp M +2 -0 tests/no-module-include/main.cpp M +2 -0 tests/no-module-include/main.cpp.expected https://invent.kde.org/sdk/clazy/-/commit/2965bc3fca609f4a401709263f0d0fdcff8bf763