aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsloggingutils.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Compiler: Avoid generating duplicate settings namesOlivier De Cannière2025-10-221-2/+4
| | | | | | | | | | | | The two computations may result in the same string. Insert the second one only if it is differnt. Amends c4455f1771483c8ed63d27454242f19b28b524b0 Pick-to: 6.10 Change-Id: I0c4df0cf6bb5bba2c1cf6c50b8a7f105718b85ee Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Compiler: Clean up LoggerCategoryPrivateOlivier De Cannière2025-10-221-22/+18
| | | | | | | | | Unfriend LoggerCategory and actually implement accessor functions. Amends cdd7fe05f676ed1664a156beaf63093237a3beac Change-Id: Iee580f98d84ec554467cb8ab779a4178c7f745fc Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Add security header for src/qmlcompilerOlivier De Cannière2025-09-171-0/+1
| | | | | | | | | | | | | | | | | | We assume that QML or JS code comes from a trusted source. Therefore, most files are deemed to be significant even if they parse data. This includes the source code itself but also the associated metadata or cache files. However, the QML compiler also generates C++ code. Extra care needs to be taken with the generator as a vulnerability there could propagate and have a disproportionate effect on the program's security. It is marked as critical. QUIP: 23 Fixes: QTBUG-136195 Pick-to: 6.10 6.9 6.8 Change-Id: I70630361ec8e9cb3969f78a3fdf36a41334a33b3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Pass QString and callbacks by const refUlf Hermann2025-06-271-2/+3
| | | | | | | Passing them by value forces redundant copies. Change-Id: I4f1da48155e3326c1d6bfa1933ee2e520e516924 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: fix setting for alias cycle and unresolved aliasSami Shalayel2025-03-251-2/+21
| | | | | | | | | | | Make sure both have their own setting key, but still support the previous "buggy" setting key. Print a deprecated warning when finding the buggy setting key in a setting file. Task-number: QTBUG-135020 Change-Id: I364e7e41380de43a0883bcf4d3f6cefcf11b6c90 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Fix issues with \fn signaturesTopi Reinio2025-03-061-18/+18
| | | | | | | | | | | | | | Move QQmlSA::LoggerWarningId function documentation out of the QQmlJS namespace, as that causes match failures with QDoc. Qualify QQmlSA::Method and Element \fn signatures with the correct scope to help QDoc match them. Task-number: QTBUG-134250 Pick-to: 6.9 6.8 Change-Id: I89407afe251158d99a93f44c25bb6db1a83a6024 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* Doc: Add more documentation for QQmlSAOlivier De Cannière2025-02-281-0/+10
| | | | | | | | | | | Some documentation may not provide a lot of extra information but is there mainly so that the function appears in the final documentation and is discoverable by the user. Fixes: QTBUG-116682 Pick-to: 6.9 6.8 Change-Id: I68e531663a25ea9aaba9dfd4ec0c8b842023f673 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: add an "error" logging categorySami Shalayel2024-12-121-3/+14
| | | | | | | | | | | | | | Add support for a critical error category in qmllint called "error", so that the qds plugin can show errors for unsupported components for example. Add a test. The error category makes qmllint return -1. Simplify a bit the logic of the "success" bool in lintFile() by making it a LintResult and returning it. Change-Id: Ide6a6a265f1aeede0fcbc35d9e4d0abe3f5c2aa3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint plugins: prefix settingsname with plugin nameSami Shalayel2024-11-041-14/+33
| | | | | | | | | | | | | | | | | | | | | | | | | Prefix the logging category name with the plugin's name, in the same way as the category id's are also prefixed. Fixed a test from bc709184afcb8373be6d69309cb53294455d7248 that did not test anything. Add a flag to callQmllint() that enables to read settings, and make sure that a warning is actually emitted when the settings are not read for the settings/plugin/elementPass_pluginTest.qml file. The latter file was also renamed because the test lint plugin only enables itself on files ending with "pluginTest.qml". Add a compatibility mode that allows loading "old" .qmllint.ini files where the settings names do not contain the plugin name. [ChangeLog][Important Behavior Change] Qmllint prefixes logging categories from plugins with the plugin name in .qmllint.ini files. For example, PropertyChangesParsed=disable becomes Quick.PropertyChangesParsed=disable. Fixes: QTBUG-130357 Change-Id: I47a0bf22991d6a438aa3371c666da34f2c2835bc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: allow plugins to set default category levelSami Shalayel2024-10-291-10/+21
| | | | | | | | Add a defaultLevel value to the .json file shipped with the plugins that allow plugins to set the default level of their categories. Change-Id: I4a13366ce705ba104414b41e729d12769ab83821 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* qmlls: follow .qmllint.ini warning configurationsSami Shalayel2024-08-011-1/+77
| | | | | | | | | | | | | Move the methods used to set the linting category level from qmllint/main.cpp to qqmljsloggingutils{.cpp,_p.h} so that qmlls can reuse them to follow .qmllint.ini warning configuration files. Also add early returns to the code of updateLogLevels. Pick-to: 6.8 6.7 Fixes: QTBUG-127602 Change-Id: I12919226c340a2c7a16aac6cd319ca2483611530 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlSA: Don't expose QQmlJS namespaceFabian Kosmale2023-09-211-0/+8
| | | | | | | | | | | | | QQmlSA is meant as the public namespace, QQmlJS is (at least currently) completely internal. However, LoggerWarningID currently only existed in QQmlJS. Move it into QQmlSA, add some minimal class documentation and add a typedef in QQmlJS (inside a private header) to avoid the need to modify all users. Pick-to: 6.6.0 6.6 Change-Id: Icff860c92054ac810c6e15eb26090d38fbc2c965 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlSA: Mark move SMF noexcept and specify alignment for fast-PIMPLsOlivier De Cannière2023-05-311-2/+2
| | | | | Change-Id: Ia3dc17a31856047b9fd7c5da89320c7234847a59 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlSA: Create an abstraction layer for static analysisOlivier De Cannière2023-05-301-0/+128
This patch adds abstractions for QML Elements, Bindings, Methods and Properties. This abstraction layer avoids exposing internal details and should be more suited for static analysis tasks. It is now possible to write qmllint plugins without including private headers. As a drive-by, change tst_qmllint:verifyJsRoot to open files in text mode instead of binary. This fixes an issue where line endings cause issues on Windows. Fixes: QTBUG-102276 Change-Id: I6b6e53f1e0078734a18f3aa51807fbe875b375f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>