diff options
author | Sami Shalayel <[email protected]> | 2025-03-21 12:11:28 +0100 |
---|---|---|
committer | Sami Shalayel <[email protected]> | 2025-03-25 22:54:41 +0100 |
commit | ca0348fad24b4eb3ee2843ae2dae4b9e260d650e (patch) | |
tree | 71edd34c896ce2bf47d35cfc74af8068d03d5610 /src/qmlcompiler/qqmljsloggingutils.cpp | |
parent | 2b720dbe79d8a4a69188f44359dcf44f305b402c (diff) |
qmllint: fix setting for alias cycle and unresolved alias
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 <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'src/qmlcompiler/qqmljsloggingutils.cpp')
-rw-r--r-- | src/qmlcompiler/qqmljsloggingutils.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/qmlcompiler/qqmljsloggingutils.cpp b/src/qmlcompiler/qqmljsloggingutils.cpp index 5a75fb7a59..8eecd08242 100644 --- a/src/qmlcompiler/qqmljsloggingutils.cpp +++ b/src/qmlcompiler/qqmljsloggingutils.cpp @@ -173,6 +173,25 @@ static QStringList settingsNamesForCategory(const LoggerCategory &category) return result; } +static QString lookInSettings(const LoggerCategory &category, const QQmlToolingSettings &settings, + const QString &settingsName) +{ + if (settings.isSet(settingsName)) + return settings.value(settingsName).toString(); + static constexpr QLatin1String propertyAliasCyclesKey = "Warnings/PropertyAliasCycles"_L1; + + // keep compatibility to deprecated settings + if (category.name() == qmlAliasCycle.name() || category.name() == qmlUnresolvedAlias.name()) { + if (settings.isSet(propertyAliasCyclesKey)) { + qWarning() + << "Detected deprecated setting name \"PropertyAliasCycles\". Use %1 or %2 instead."_L1 + .arg(qmlAliasCycle.name(), qmlUnresolvedAlias.name()); + return settings.value(propertyAliasCyclesKey).toString(); + } + } + return {}; +} + static QString levelValueForCategory(const LoggerCategory &category, const QQmlToolingSettings &settings, QCommandLineParser *parser) @@ -183,9 +202,9 @@ static QString levelValueForCategory(const LoggerCategory &category, const QStringList settingsName = settingsNamesForCategory(category); for (const QString &settingsName : settingsName) { - if (!settings.isSet(settingsName)) + const QString value = lookInSettings(category, settings, settingsName); + if (value.isEmpty()) continue; - const QString value = settings.value(settingsName).toString(); // Do not try to set the levels if it's due to a default config option. // This way we can tell which options have actually been overwritten by the user. |