diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-11-14 16:31:48 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-01-13 16:54:35 +0100 |
commit | 3dc5b937c4e9acf83ee54e870390c22f341c29c8 (patch) | |
tree | f1020183bc6d9b3b7c84635b3b5d7aa30b46f6df | |
parent | d31bb553b543cc43591c31a35d054504aa756bdc (diff) |
qmllint: Consider failure to find imports an error
There is no real reason to tolerate it. We can generate all qmltypes at
build time, and if we can't find them, the results are likely to be off.
Change-Id: Id935d76ac3ca6b601381b40a73d7fbacca342c4d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | tests/auto/qml/qmllint/data/unknownElement.qml (renamed from tests/auto/qml/qmllint/data/spuriousParentWarning.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 6 | ||||
-rw-r--r-- | tools/qmllint/findunqualified.cpp | 1 |
3 files changed, 4 insertions, 3 deletions
diff --git a/tests/auto/qml/qmllint/data/spuriousParentWarning.qml b/tests/auto/qml/qmllint/data/unknownElement.qml index 1323593031..1323593031 100644 --- a/tests/auto/qml/qmllint/data/spuriousParentWarning.qml +++ b/tests/auto/qml/qmllint/data/unknownElement.qml diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 03412f0144..1cd9f8b0d1 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -48,7 +48,7 @@ private Q_SLOTS: void dirtyQmlCode_data(); void dirtyQmlCode(); - void testUnqualifiedNoSpuriousParentWarning(); + void testUnknownCausesFail(); private: QString runQmllint(const QString &fileToLint, bool shouldSucceed); @@ -107,9 +107,9 @@ void TestQmllint::testUnqualified_data() QTest::newRow("NonSpuriousParent") << QStringLiteral("nonSpuriousParentWarning.qml") << QStringLiteral("property int x: <id>.parent.x") << 6 << 25; } -void TestQmllint::testUnqualifiedNoSpuriousParentWarning() +void TestQmllint::testUnknownCausesFail() { - const QString unknownNotFound = runQmllint("spuriousParentWarning.qml", false); + const QString unknownNotFound = runQmllint("unknownElement.qml", false); QVERIFY(unknownNotFound.contains( QStringLiteral("warning: Unknown was not found. Did you add all import paths?"))); } diff --git a/tools/qmllint/findunqualified.cpp b/tools/qmllint/findunqualified.cpp index dc1bb29567..88466cfae9 100644 --- a/tools/qmllint/findunqualified.cpp +++ b/tools/qmllint/findunqualified.cpp @@ -388,6 +388,7 @@ void FindUnqualifiedIDVisitor::importExportedNames(const QStringRef &prefix, QSt m_colorOut.write(name + QLatin1String(" was not found." " Did you add all import paths?\n")); m_unknownImports.insert(name); + m_visitFailed = true; break; } } |