diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-05-27 14:32:43 +0200 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-06-03 08:54:57 +0200 |
commit | 9f389ee75dfcbf8ad56fa4ceac0f28d2a81194e1 (patch) | |
tree | 3218652b643cc54a989960c15a59f16ba19f578c /tools/qmllint/main.cpp | |
parent | 609a21eac694f15c74c9f53b49473cd08588ef40 (diff) |
qmllint: Add ability to ignore individual warnings
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>
Diffstat (limited to 'tools/qmllint/main.cpp')
-rw-r--r-- | tools/qmllint/main.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp index 7e3962fe0b..7f4c63439f 100644 --- a/tools/qmllint/main.cpp +++ b/tools/qmllint/main.cpp @@ -168,7 +168,8 @@ static bool lint_file(const QString &filename, const bool silent, QJsonArray *js importer.setResourceFileMapper(mapper); - FindWarningVisitor v { &importer, qmltypesFiles, code, filename, silent || json }; + FindWarningVisitor v { &importer, qmltypesFiles, code, + engine.comments(), filename, silent || json }; for (auto it = options.cbegin(); it != options.cend(); ++it) { v.logger().setCategoryDisabled(it.value().m_category, it.value().m_disabled); |