The default AOT compiler compiles QML code in indirect, dynamic mode. It
uses the logger's Log_Compiler category to determine the verbosity of
its output. In addition you can use the qt.qml.compiler.aot category for
even more verbosity. In preparation for using QQmlJSAotCompiler with
qmlcachegen, the default level of that category is increased to
QtFatalMsg. The highest level we actually output is QtDebugMsg, so it
doesn't make a difference yet.
If the logger's Log_Compiler category is set to produce errors, it will
qFatal() on "pragma Strict" violations.
Change-Id: Ieb74bfa7cd51cfa8616792ab467c32f6ba0e0702
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Some code was not properly wrapped in a namespace.
Change-Id: If70fd9782391309c511b66ae01eae43cb36292ac
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It makes no sense to use a higher message level for a fix suggestion. A
fix suggestion should be prefixed by the warning or error that triggers
it. That warning or error should have the actual level.
Change-Id: I4b5a2ec150afd469ea53697546541a7890c525ec
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is mostly useful as an replacement for Quick Controls' tst_sanity but might also be useful in some other instances.
Fixes: QTBUG-96572
Change-Id: I5cf414bfeb369cbc394563c5c5ed807599b09a2f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Another warning ability we need in order to replace controls' tst_sanity with something more sensible.
Probably not useful outside of that, so it is disabled by default.
Fixes: QTBUG-96573
Change-Id: I6241899f167f7ea5463ff5b3f157c616c1936cd2
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
- convert to string to in a couple of places to work without
QStringView + operator
- import local files with "*" (not via <private/*>)
Change-Id: I1d7cdcbd39e609f36693733e98d4f74a7260ce88
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This change helps bring in type inference and compiler warnings previously only generated by qmlcachegen+.
These warnings are disabled by default and have to be enabled manually via the --compiler option.
Also makes the logger handle zero length SourceLocations properly by just highlighting the entire line instead of hitting an assert.
Change-Id: Iebad6e9236214d9367f97487e7b5787592edab7d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
qmllint now supports logging levels of different severities. Still lacking a good way to toggle the verbosity more granularly though (i.e. disabling only info messages while still receiving the rest).
Change-Id: I71abddcdf1adf60315a87d776af8085acf7aeffe
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
They are now handled by the logger instead of being done by external classes using the ColorOutput directly.
This will allow for modernizing the logger and for automatically applying those suggested fixes.
Fixes: QTBUG-94170
Change-Id: I90b960d22cb91203b8e8a5c69b0fdaf6fca2fc0c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Allows users to ignore individual warnings by adding a "// qmllint disable" comment in the line that triggers the warning.
This feature is especially useful for use in pre-commit / CI tests as it allows to add exceptions for individual warnings that cannot be fixed immediately.
[ChangeLog][qmllint][New Feature] You can now ignore individual warnings by adding "// qmllint disable"
in the line causing it. You may also specify one or more warning type to ignore ("// qmllint disable warningtype1 warningtype2...") which is preferable. This can also be done for entire blocks of code by using "// qmllint disable" in an empty line and ending it with "// qmllint enable"
Change-Id: Iea6c29132d6b51ecfb5e5d8a19a43446a7286c24
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This change adds support for a reading a simple settings file (.qmllint.ini) to set log levels and various other options.
The settings file applies on a per-directory basis so linting files in two subdirectories with different settings will use their respective settings files.
If the directory of the linted file does not contain any settings we search through all parent directories.
This is implemented in a way that qmlformat can also utilize the settings file code.
This makes qmllint more useful for larger projects that might want different settings for different parts of their QML code.
It also allows for better integration in CI checks and pre-commit hooks.
[ChangeLog][General][qmllint] Adds the ability to set linting options via a settings file rather than using command line parameters. Use --write-defaults to generate a template with default values for editing. Use --ignore-settings to disable this feature
Change-Id: I94e4a47916b5dfd16c3a69efdba3858235cab738
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Adds support for inline components for qmllint with a few things not working yet:
- Two inline components referencing each other
- Using inline components before they are declared
These two issues require a larger overhaul of qmllint as a whole and will be addressed in a different change.
Change-Id: I2834702c21a8eb728db4709d6f475c33796b3e4d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Add the ability to individually disable and set the severity of all warnings produced by qmllint.
Change-Id: I46081f8b37fb90f8d0f4a5f2f08223d7b7285041
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Import warnings will now always be clearly associated with the line and import that
caused them. They're also visually separated now and don't redundantly show the importing files name in every warning.
Some type of imports such as file or URI based imports never had their warnings processed which is also fixed by this change.
Change-Id: I63d720fcf198ff5302c2566a91cde4c716697f7e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Improves the logging situation greatly by allowing all logging messages to be assigned different severities,
highlighting the code that caused them and by now ensuring a qmllint warning will always result in a non-zero exit code.
A later patch will expose more of these options to the user.
Change-Id: Id9b036fe3ba80dd18e9f8cb1b05efa891713d5a8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>