aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljscontextproperties.cpp
Commit message (Collapse)AuthorAgeFilesLines
* qmllint: don't grep twice for context propertiesSami Shalayel2025-08-051-4/+12
| | | | | | | | | It seems that we grep twice when grep returns 1. From the manual, a return code of 1 means nothing was found and in this case we shouldn't run the fallback grep method. Change-Id: Id8993ca914cefb8bb806f77334508be46fb60fbe Reviewed-by: Fabian Kosmale <[email protected]>
* qmllint: make contextproperties a real class and renameSami Shalayel2025-08-051-30/+40
| | | | | | | | | | | | | | | | | | | | | | | | | Prepares for QTBUG-138061 where we need a way to load user-defined context properties into QQmlJS::ContextProperties. Rename QQmlJS::ContextProperties into HeuristicContextProperties to avoid confusions with the UserContextProperties. Make HeuristicContextProperties a real class so that we can add methods to load and save context properties to and from disk. Make the heuristics be saved in a list instead of a QHash, as the order of the property matters as we write them out into a file and testing becomes complicated when the order changes between different runs. Also note that it might be confusing for qmlls users if their warnings change orders during multiple runs. Rename some methods for clarity. Task-number: QTBUG-138061 Task-number: QTBUG-128232 Change-Id: Ib6302f609e182e622015293366c8b42425566a0e Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* QQmlJSContextProperty: add isWarningEnabledSami Shalayel2025-05-221-0/+9
| | | | | | | | | Add a helper in QQmlJSContextProperties to check whether the qmlContextProperty warning is enabled. To be used in qmllint and qmlls. Task-number: QTBUG-128232 Change-Id: I644700379b86d8ace4eb0d4174cdef0983b19486 Reviewed-by: Ulf Hermann <[email protected]>
* qqmljscontextproperties: "grep" for setContextProperty callsSami Shalayel2025-05-221-0/+123
Add code to Grep the project folder for "setContextProperty" calls, so that a later commit can warn about usages of those context properties. Use grep to find files with setContextProperty calls, and then run a QRegularExpression on the files to extract the names and locations of the context properties. Add a fallback in case there is no grep on the system, and don't run grep on windows. Also avoid unused functions errors on windows where grep is not run so its output also does not need to be parsed. Task-number: QTBUG-128232 Change-Id: I15ceb2bbeb6ae6ac83f4bfa85b8a44d5a897d0a7 Reviewed-by: Olivier De Cannière <[email protected]>