ClangTools: Make sure clazy doc URL corresponds to tool version

Note that this will only work with clazy >= 1.10. For earlier versions,
we fall back to the master branch documentation, as before.

Fixes: QTCREATORBUG-25869
Change-Id: I7a8188eda15c4e0548bfaa63aa90f721aa44d6c2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-07-26 15:42:28 +02:00
parent c5d080570b
commit 1b1e18a869
7 changed files with 35 additions and 13 deletions

View File

@@ -166,7 +166,23 @@ ClangTidyInfo::ClangTidyInfo(const QString &executablePath)
ClazyStandaloneInfo::ClazyStandaloneInfo(const QString &executablePath)
: defaultChecks(queryClangTidyChecks(executablePath, {})) // Yup, behaves as clang-tidy.
, supportedChecks(querySupportedClazyChecks(executablePath))
{}
{
QString output = runExecutable(CommandLine(executablePath, {"--version"}),
QueryFailMode::Silent);
QTextStream stream(&output);
while (!stream.atEnd()) {
// It's just "clazy version " right now, but let's be prepared for someone adding a colon
// later on.
static const QStringList versionPrefixes{"clazy version ", "clazy version: "};
const QString line = stream.readLine().simplified();
for (const QString &prefix : versionPrefixes) {
if (line.startsWith(prefix)) {
version = QVersionNumber::fromString(line.mid(prefix.length()));
break;
}
}
}
}
static FilePath queryResourceDir(const FilePath &clangToolPath)
{