diff options
author | Sami Shalayel <sami.shalayel@qt.io> | 2022-11-28 08:55:40 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-11-28 12:24:01 +0000 |
commit | 1ed9f22ec893f11e858d95fc9a8a9dca60ea9f6f (patch) | |
tree | a3a6bc9978e8b540c21ff72ebb2b5b22803124ab | |
parent | 2e2ffdea3e210a87fd60e75359865d8600a9ed11 (diff) |
qmllint: document new behavior of --json
Amends 5c04d174282a9a36ce12b26e1807d3d5051a7f33.
The behavior of qmllint changed in the above-mentioned commit, as it
started expecting a file argument for the --json option. Before, it was
not expecting any and always writing to stdout.
Document the new behavior in the docs and in the --help command,
especially the part about using '-' to restore the old behavior.
Fixes: QTBUG-108913
Change-Id: I3a69a794a5362a575437d3d832d6e038c7a0755a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e11c1eda4fbd1910f9089dae60e4d22bfe3bb595)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/quick/doc/src/guidelines/qtquick-tool-qmllint.qdoc | 4 | ||||
-rw-r--r-- | tools/qmllint/main.cpp | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/quick/doc/src/guidelines/qtquick-tool-qmllint.qdoc b/src/quick/doc/src/guidelines/qtquick-tool-qmllint.qdoc index 6ca5f4f47b..0a9d6dbc58 100644 --- a/src/quick/doc/src/guidelines/qtquick-tool-qmllint.qdoc +++ b/src/quick/doc/src/guidelines/qtquick-tool-qmllint.qdoc @@ -129,9 +129,9 @@ that take precedence over the warning levels in settings. \section2 Scripting -qmllint can output JSON via the \c{--json} option which will return valid JSON +qmllint can write or output JSON via the \c{--json <file>} option which will return valid JSON with warning messages, file and line location of warnings, and their severity -level. +level. Use the special filename '-' to write to stdout instead of a file. This can be used to more easily integrate qmllint in your pre-commit hooks or CI testing. diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp index 6171d92360..3193a6d807 100644 --- a/tools/qmllint/main.cpp +++ b/tools/qmllint/main.cpp @@ -66,7 +66,8 @@ All warnings can be set to three levels: parser.addOption(silentOption); QCommandLineOption jsonOption(QStringList() << "json", - QLatin1String("Write output as JSON to file"), + QLatin1String("Write output as JSON to file (or use the special " + "filename '-' to write to stdout)"), QLatin1String("file"), QString()); parser.addOption(jsonOption); |