aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2022-11-28 08:55:40 +0100
committerSami Shalayel <sami.shalayel@qt.io>2022-11-28 10:49:23 +0100
commite11c1eda4fbd1910f9089dae60e4d22bfe3bb595 (patch)
treed96ec27fe7765f8619e852b5a2eed4b51692380e
parent0765c176e7b7ee73b1ac6d6efdabc93e4dec978f (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 Pick-to: 6.4 Change-Id: I3a69a794a5362a575437d3d832d6e038c7a0755a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/quick/doc/src/guidelines/qtquick-tool-qmllint.qdoc4
-rw-r--r--tools/qmllint/main.cpp3
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 95cd2ec29c..924691780b 100644
--- a/tools/qmllint/main.cpp
+++ b/tools/qmllint/main.cpp
@@ -55,7 +55,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);