2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2014-09-25 11:11:58 +02:00
|
|
|
|
2018-01-17 15:08:30 +01:00
|
|
|
#include "clangtoolsutils.h"
|
2014-09-25 11:11:58 +02:00
|
|
|
|
2019-06-25 11:10:00 +02:00
|
|
|
#include "clangtool.h"
|
2019-08-28 08:56:22 +02:00
|
|
|
#include "clangtoolsconstants.h"
|
2018-01-17 15:08:30 +01:00
|
|
|
#include "clangtoolsdiagnostic.h"
|
|
|
|
|
#include "clangtoolssettings.h"
|
2023-01-11 23:48:53 +01:00
|
|
|
#include "clangtoolstr.h"
|
2014-09-25 11:11:58 +02:00
|
|
|
|
2018-04-30 15:26:36 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2021-08-30 10:58:08 +02:00
|
|
|
#include <cppeditor/cppeditorconstants.h>
|
|
|
|
|
#include <cppeditor/cpptoolsreuse.h>
|
2015-07-07 15:24:47 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
|
2019-06-25 11:10:00 +02:00
|
|
|
#include <utils/checkablemessagebox.h>
|
2014-09-25 11:11:58 +02:00
|
|
|
#include <utils/environment.h>
|
2021-08-12 09:19:55 +02:00
|
|
|
#include <utils/filepath.h>
|
2019-06-25 11:10:00 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
2022-07-27 12:38:07 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2021-05-05 18:21:22 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
2014-09-25 11:11:58 +02:00
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
#include <cppeditor/clangdiagnosticconfigsmodel.h>
|
2019-09-25 15:46:15 +02:00
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
using namespace CppEditor;
|
2021-08-12 09:19:55 +02:00
|
|
|
using namespace Utils;
|
2014-09-25 11:11:58 +02:00
|
|
|
|
2018-03-14 12:58:12 +01:00
|
|
|
namespace ClangTools {
|
2014-09-25 11:11:58 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2020-07-21 13:11:01 +02:00
|
|
|
static QString lineColumnString(const Debugger::DiagnosticLocation &location)
|
|
|
|
|
{
|
|
|
|
|
return QString("%1:%2").arg(QString::number(location.line), QString::number(location.column));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static QString fixitStatus(FixitStatus status)
|
|
|
|
|
{
|
|
|
|
|
switch (status) {
|
|
|
|
|
case FixitStatus::NotAvailable:
|
2023-01-19 18:42:01 +01:00
|
|
|
return Tr::tr("No Fixits");
|
2020-07-21 13:11:01 +02:00
|
|
|
case FixitStatus::NotScheduled:
|
2023-01-19 18:42:01 +01:00
|
|
|
return Tr::tr("Not Scheduled");
|
2020-07-21 13:11:01 +02:00
|
|
|
case FixitStatus::Invalidated:
|
2023-01-19 18:42:01 +01:00
|
|
|
return Tr::tr("Invalidated");
|
2020-07-21 13:11:01 +02:00
|
|
|
case FixitStatus::Scheduled:
|
2023-01-19 18:42:01 +01:00
|
|
|
return Tr::tr("Scheduled");
|
2020-07-21 13:11:01 +02:00
|
|
|
case FixitStatus::FailedToApply:
|
2023-01-19 18:42:01 +01:00
|
|
|
return Tr::tr("Failed to Apply");
|
2020-07-21 13:11:01 +02:00
|
|
|
case FixitStatus::Applied:
|
2023-01-19 18:42:01 +01:00
|
|
|
return Tr::tr("Applied");
|
2020-07-21 13:11:01 +02:00
|
|
|
}
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString createDiagnosticToolTipString(
|
|
|
|
|
const Diagnostic &diagnostic,
|
2022-08-26 10:30:00 +02:00
|
|
|
std::optional<FixitStatus> status,
|
2020-07-21 13:11:01 +02:00
|
|
|
bool showSteps)
|
|
|
|
|
{
|
|
|
|
|
using StringPair = QPair<QString, QString>;
|
|
|
|
|
QList<StringPair> lines;
|
|
|
|
|
|
|
|
|
|
if (!diagnostic.category.isEmpty()) {
|
2023-01-19 18:42:01 +01:00
|
|
|
lines.push_back({Tr::tr("Category:"),
|
2022-09-30 14:11:20 +02:00
|
|
|
diagnostic.category.toHtmlEscaped()});
|
2020-07-21 13:11:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!diagnostic.type.isEmpty()) {
|
2023-01-19 18:42:01 +01:00
|
|
|
lines.push_back({Tr::tr("Type:"),
|
2022-09-30 14:11:20 +02:00
|
|
|
diagnostic.type.toHtmlEscaped()});
|
2020-07-21 13:11:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!diagnostic.description.isEmpty()) {
|
2023-01-19 18:42:01 +01:00
|
|
|
lines.push_back({Tr::tr("Description:"),
|
2022-09-30 14:11:20 +02:00
|
|
|
diagnostic.description.toHtmlEscaped()});
|
2020-07-21 13:11:01 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-19 18:42:01 +01:00
|
|
|
lines.push_back({Tr::tr("Location:"),
|
2022-09-30 14:11:20 +02:00
|
|
|
createFullLocationString(diagnostic.location)});
|
2020-07-21 13:11:01 +02:00
|
|
|
|
|
|
|
|
if (status) {
|
2023-01-19 18:42:01 +01:00
|
|
|
lines.push_back({Tr::tr("Fixit status:"),
|
2022-09-30 14:11:20 +02:00
|
|
|
fixitStatus(*status)});
|
2020-07-21 13:11:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (showSteps && !diagnostic.explainingSteps.isEmpty()) {
|
|
|
|
|
StringPair steps;
|
2023-01-19 18:42:01 +01:00
|
|
|
steps.first = Tr::tr("Steps:");
|
2020-07-21 13:11:01 +02:00
|
|
|
for (const ExplainingStep &step : diagnostic.explainingSteps) {
|
|
|
|
|
if (!steps.second.isEmpty())
|
|
|
|
|
steps.second += "<br>";
|
|
|
|
|
steps.second += QString("%1:%2: %3")
|
2021-05-28 12:37:35 +02:00
|
|
|
.arg(step.location.filePath.toUserOutput(),
|
2020-07-21 13:11:01 +02:00
|
|
|
lineColumnString(step.location),
|
|
|
|
|
step.message);
|
|
|
|
|
}
|
|
|
|
|
lines << steps;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-15 15:05:05 +01:00
|
|
|
const QString url = documentationUrl(diagnostic.name);
|
|
|
|
|
if (!url.isEmpty()) {
|
2023-01-19 18:42:01 +01:00
|
|
|
lines.push_back({Tr::tr("Documentation:"),
|
2022-09-30 14:11:20 +02:00
|
|
|
QString("<a href=\"%1\">%1</a>").arg(url)});
|
2021-01-15 15:05:05 +01:00
|
|
|
}
|
|
|
|
|
|
2020-07-21 13:11:01 +02:00
|
|
|
QString html = QLatin1String("<html>"
|
|
|
|
|
"<head>"
|
|
|
|
|
"<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>"
|
|
|
|
|
"</head>\n"
|
|
|
|
|
"<body><dl>");
|
|
|
|
|
|
2022-10-07 14:46:06 +02:00
|
|
|
for (const StringPair &pair : std::as_const(lines)) {
|
2020-07-21 13:11:01 +02:00
|
|
|
html += QLatin1String("<dt>");
|
|
|
|
|
html += pair.first;
|
|
|
|
|
html += QLatin1String("</dt><dd>");
|
|
|
|
|
html += pair.second;
|
|
|
|
|
html += QLatin1String("</dd>\n");
|
|
|
|
|
}
|
|
|
|
|
html += QLatin1String("</dl></body></html>");
|
|
|
|
|
return html;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
QString createFullLocationString(const Debugger::DiagnosticLocation &location)
|
2014-09-25 11:11:58 +02:00
|
|
|
{
|
2021-05-28 12:37:35 +02:00
|
|
|
return location.filePath.toUserOutput() + QLatin1Char(':') + QString::number(location.line)
|
2018-01-17 15:08:30 +01:00
|
|
|
+ QLatin1Char(':') + QString::number(location.column);
|
2014-09-25 11:11:58 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-25 11:10:00 +02:00
|
|
|
QString hintAboutBuildBeforeAnalysis()
|
|
|
|
|
{
|
2023-01-19 18:42:01 +01:00
|
|
|
return Tr::tr(
|
2019-06-25 11:10:00 +02:00
|
|
|
"In general, the project should be built before starting the analysis to ensure that the "
|
|
|
|
|
"code to analyze is valid.<br/><br/>"
|
|
|
|
|
"Building the project might also run code generators that update the source files as "
|
|
|
|
|
"necessary.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void showHintAboutBuildBeforeAnalysis()
|
|
|
|
|
{
|
|
|
|
|
Utils::CheckableMessageBox::doNotShowAgainInformation(
|
|
|
|
|
Core::ICore::dialogParent(),
|
2023-01-19 18:42:01 +01:00
|
|
|
Tr::tr("Info About Build the Project Before Analysis"),
|
2019-06-25 11:10:00 +02:00
|
|
|
hintAboutBuildBeforeAnalysis(),
|
|
|
|
|
Core::ICore::settings(),
|
|
|
|
|
"ClangToolsDisablingBuildBeforeAnalysisHint");
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-12 09:19:55 +02:00
|
|
|
FilePath fullPath(const FilePath &executable)
|
2019-08-28 08:56:22 +02:00
|
|
|
{
|
2021-08-12 09:19:55 +02:00
|
|
|
FilePath candidate = executable;
|
2021-08-17 14:16:08 +02:00
|
|
|
const bool hasSuffix = candidate.endsWith(QTC_HOST_EXE_SUFFIX);
|
2019-08-28 08:56:22 +02:00
|
|
|
|
2021-08-12 09:19:55 +02:00
|
|
|
if (candidate.isAbsolutePath()) {
|
2019-08-28 08:56:22 +02:00
|
|
|
if (!hasSuffix)
|
2021-08-12 09:19:55 +02:00
|
|
|
candidate = candidate.withExecutableSuffix();
|
2019-08-28 08:56:22 +02:00
|
|
|
} else {
|
2021-08-12 09:19:55 +02:00
|
|
|
const Environment environment = Environment::systemEnvironment();
|
|
|
|
|
const FilePath expandedPath = environment.searchInPath(candidate.toString());
|
2019-08-28 08:56:22 +02:00
|
|
|
if (!expandedPath.isEmpty())
|
|
|
|
|
candidate = expandedPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return candidate;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-12 09:19:55 +02:00
|
|
|
static FilePath findValidExecutable(const FilePaths &candidates)
|
2019-08-28 08:56:22 +02:00
|
|
|
{
|
2021-08-12 09:19:55 +02:00
|
|
|
for (const FilePath &candidate : candidates) {
|
|
|
|
|
const FilePath expandedPath = fullPath(candidate);
|
|
|
|
|
if (expandedPath.isExecutableFile())
|
2019-08-28 08:56:22 +02:00
|
|
|
return expandedPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-10 16:36:59 +01:00
|
|
|
FilePath toolShippedExecutable(ClangToolType tool)
|
2019-08-28 08:56:22 +02:00
|
|
|
{
|
2023-01-10 16:36:59 +01:00
|
|
|
const FilePath shippedExecutable = tool == ClangToolType::Tidy
|
|
|
|
|
? Core::ICore::clangTidyExecutable(CLANG_BINDIR)
|
|
|
|
|
: Core::ICore::clazyStandaloneExecutable(CLANG_BINDIR);
|
|
|
|
|
if (shippedExecutable.isExecutableFile())
|
|
|
|
|
return shippedExecutable;
|
|
|
|
|
return {};
|
2019-08-28 08:56:22 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-10 16:36:59 +01:00
|
|
|
FilePath toolExecutable(ClangToolType tool)
|
2019-08-28 08:56:22 +02:00
|
|
|
{
|
2023-01-10 16:36:59 +01:00
|
|
|
const FilePath fromSettings = ClangToolsSettings::instance()->executable(tool);
|
2019-08-28 08:56:22 +02:00
|
|
|
if (!fromSettings.isEmpty())
|
|
|
|
|
return fullPath(fromSettings);
|
2023-01-10 16:36:59 +01:00
|
|
|
return toolFallbackExecutable(tool);
|
2019-10-21 14:59:57 +02:00
|
|
|
}
|
2019-08-28 08:56:22 +02:00
|
|
|
|
2023-01-10 16:36:59 +01:00
|
|
|
FilePath toolFallbackExecutable(ClangToolType tool)
|
2019-10-21 14:59:57 +02:00
|
|
|
{
|
2023-01-10 16:36:59 +01:00
|
|
|
const FilePath fallback = tool == ClangToolType::Tidy
|
|
|
|
|
? FilePath(Constants::CLANG_TIDY_EXECUTABLE_NAME)
|
|
|
|
|
: FilePath(Constants::CLAZY_STANDALONE_EXECUTABLE_NAME);
|
|
|
|
|
return findValidExecutable({toolShippedExecutable(tool), fallback});
|
2019-10-21 14:59:57 +02:00
|
|
|
}
|
2019-09-25 15:46:15 +02:00
|
|
|
|
2023-01-11 23:48:53 +01:00
|
|
|
QString clangToolName(CppEditor::ClangToolType tool)
|
|
|
|
|
{
|
|
|
|
|
return tool == ClangToolType::Tidy ? Tr::tr("Clang-Tidy") : Tr::tr("Clazy");
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-11 20:15:33 +01:00
|
|
|
bool isVFSOverlaySupported(const FilePath &executable)
|
|
|
|
|
{
|
|
|
|
|
static QMap<FilePath, bool> vfsCapabilities;
|
|
|
|
|
auto it = vfsCapabilities.find(executable);
|
|
|
|
|
if (it == vfsCapabilities.end()) {
|
|
|
|
|
QtcProcess p;
|
|
|
|
|
p.setCommand({executable, {"--help"}});
|
|
|
|
|
p.runBlocking();
|
|
|
|
|
it = vfsCapabilities.insert(executable, p.allOutput().contains("vfsoverlay"));
|
|
|
|
|
}
|
|
|
|
|
return it.value();
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-25 15:46:15 +02:00
|
|
|
static void addBuiltinConfigs(ClangDiagnosticConfigsModel &model)
|
2020-11-12 14:15:36 +01:00
|
|
|
{
|
|
|
|
|
model.appendOrUpdate(builtinConfig());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ClangDiagnosticConfig builtinConfig()
|
2019-09-25 15:46:15 +02:00
|
|
|
{
|
|
|
|
|
ClangDiagnosticConfig config;
|
|
|
|
|
config.setId(Constants::DIAG_CONFIG_TIDY_AND_CLAZY);
|
2023-01-19 18:42:01 +01:00
|
|
|
config.setDisplayName(Tr::tr("Default Clang-Tidy and Clazy checks"));
|
2019-09-25 15:46:15 +02:00
|
|
|
config.setIsReadOnly(true);
|
2019-10-21 14:59:57 +02:00
|
|
|
config.setClangOptions({"-w"}); // Do not emit any clang-only warnings
|
2019-10-24 11:31:42 +02:00
|
|
|
config.setClangTidyMode(ClangDiagnosticConfig::TidyMode::UseDefaultChecks);
|
|
|
|
|
config.setClazyMode(ClangDiagnosticConfig::ClazyMode::UseDefaultChecks);
|
2020-11-12 14:15:36 +01:00
|
|
|
return config;
|
2019-09-25 15:46:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ClangDiagnosticConfigsModel diagnosticConfigsModel(const ClangDiagnosticConfigs &customConfigs)
|
|
|
|
|
{
|
|
|
|
|
ClangDiagnosticConfigsModel model;
|
|
|
|
|
addBuiltinConfigs(model);
|
|
|
|
|
for (const ClangDiagnosticConfig &config : customConfigs)
|
|
|
|
|
model.appendOrUpdate(config);
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ClangDiagnosticConfigsModel diagnosticConfigsModel()
|
|
|
|
|
{
|
|
|
|
|
return Internal::diagnosticConfigsModel(ClangToolsSettings::instance()->diagnosticConfigs());
|
2019-08-28 08:56:22 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-29 09:52:02 +01:00
|
|
|
QString documentationUrl(const QString &checkName)
|
|
|
|
|
{
|
|
|
|
|
QString name = checkName;
|
|
|
|
|
const QString clangPrefix = "clang-diagnostic-";
|
|
|
|
|
if (name.startsWith(clangPrefix))
|
|
|
|
|
return {}; // No documentation for this.
|
|
|
|
|
|
|
|
|
|
QString url;
|
|
|
|
|
const QString clazyPrefix = "clazy-";
|
|
|
|
|
const QString clangStaticAnalyzerPrefix = "clang-analyzer-core.";
|
|
|
|
|
if (name.startsWith(clazyPrefix)) {
|
|
|
|
|
name = checkName.mid(clazyPrefix.length());
|
2021-07-26 15:42:28 +02:00
|
|
|
url = clazyDocUrl(name);
|
2019-11-29 09:52:02 +01:00
|
|
|
} else if (name.startsWith(clangStaticAnalyzerPrefix)) {
|
2021-08-30 10:58:08 +02:00
|
|
|
url = CppEditor::Constants::CLANG_STATIC_ANALYZER_DOCUMENTATION_URL;
|
2019-11-29 09:52:02 +01:00
|
|
|
} else {
|
2021-06-24 16:25:40 +02:00
|
|
|
url = clangTidyDocUrl(name);
|
2019-11-29 09:52:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-22 14:52:06 +02:00
|
|
|
ClangDiagnosticConfig diagnosticConfig(const Utils::Id &diagConfigId)
|
|
|
|
|
{
|
|
|
|
|
const ClangDiagnosticConfigsModel configs = diagnosticConfigsModel();
|
|
|
|
|
QTC_ASSERT(configs.hasConfigWithId(diagConfigId), return ClangDiagnosticConfig());
|
|
|
|
|
return configs.configWithId(diagConfigId);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-24 14:53:40 +02:00
|
|
|
static QStringList extraOptions(const QString &envVar)
|
2020-07-22 14:52:06 +02:00
|
|
|
{
|
2022-08-24 14:53:40 +02:00
|
|
|
if (!qtcEnvironmentVariableIsSet(envVar))
|
2020-07-22 14:52:06 +02:00
|
|
|
return QStringList();
|
2022-08-24 14:53:40 +02:00
|
|
|
QString arguments = qtcEnvironmentVariable(envVar);
|
2021-05-06 15:26:33 +02:00
|
|
|
return Utils::ProcessArgs::splitArgs(arguments);
|
2020-07-22 14:52:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList extraClangToolsPrependOptions()
|
|
|
|
|
{
|
|
|
|
|
constexpr char csaPrependOptions[] = "QTC_CLANG_CSA_CMD_PREPEND";
|
|
|
|
|
constexpr char toolsPrependOptions[] = "QTC_CLANG_TOOLS_CMD_PREPEND";
|
|
|
|
|
static const QStringList options = extraOptions(csaPrependOptions)
|
|
|
|
|
+ extraOptions(toolsPrependOptions);
|
|
|
|
|
if (!options.isEmpty())
|
|
|
|
|
qWarning() << "ClangTools options are prepended with " << options.toVector();
|
|
|
|
|
return options;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList extraClangToolsAppendOptions()
|
|
|
|
|
{
|
|
|
|
|
constexpr char csaAppendOptions[] = "QTC_CLANG_CSA_CMD_APPEND";
|
|
|
|
|
constexpr char toolsAppendOptions[] = "QTC_CLANG_TOOLS_CMD_APPEND";
|
|
|
|
|
static const QStringList options = extraOptions(csaAppendOptions)
|
|
|
|
|
+ extraOptions(toolsAppendOptions);
|
|
|
|
|
if (!options.isEmpty())
|
|
|
|
|
qWarning() << "ClangTools options are appended with " << options.toVector();
|
|
|
|
|
return options;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-24 16:25:40 +02:00
|
|
|
QString clangTidyDocUrl(const QString &check)
|
|
|
|
|
{
|
2022-08-15 14:28:21 +02:00
|
|
|
VersionAndSuffix version = ClangToolsSettings::clangTidyVersion();
|
|
|
|
|
version.first = QVersionNumber(version.first.majorVersion(), 0, 0);
|
|
|
|
|
if (version.first == QVersionNumber(0))
|
|
|
|
|
version.first = QVersionNumber(12);
|
|
|
|
|
static const char versionedUrlPrefix[]
|
|
|
|
|
= "https://releases.llvm.org/%1/tools/clang/tools/extra/docs/";
|
|
|
|
|
static const char unversionedUrlPrefix[] = "https://clang.llvm.org/extra/";
|
|
|
|
|
QString url = version.second.contains("git")
|
|
|
|
|
? QString::fromLatin1(unversionedUrlPrefix)
|
|
|
|
|
: QString::fromLatin1(versionedUrlPrefix).arg(version.first.toString());
|
|
|
|
|
url.append("clang-tidy/checks/");
|
|
|
|
|
if (version.first.majorVersion() < 15) {
|
2022-08-09 12:44:44 +02:00
|
|
|
url.append(check);
|
|
|
|
|
} else {
|
|
|
|
|
const int hyphenIndex = check.indexOf('-');
|
|
|
|
|
QTC_ASSERT(hyphenIndex != -1, return {});
|
|
|
|
|
url.append(check.left(hyphenIndex)).append('/').append(check.mid(hyphenIndex + 1));
|
|
|
|
|
}
|
|
|
|
|
return url.append(".html");
|
2021-06-24 16:25:40 +02:00
|
|
|
}
|
|
|
|
|
|
2021-07-26 15:42:28 +02:00
|
|
|
QString clazyDocUrl(const QString &check)
|
|
|
|
|
{
|
|
|
|
|
QVersionNumber version = ClangToolsSettings::clazyVersion();
|
|
|
|
|
if (!version.isNull())
|
2021-09-08 12:32:17 +02:00
|
|
|
version = QVersionNumber(version.majorVersion(), version.minorVersion());
|
2021-07-26 15:42:28 +02:00
|
|
|
const QString versionString = version.isNull() ? "master" : version.toString();
|
|
|
|
|
static const char urlTemplate[]
|
|
|
|
|
= "https://github.com/KDE/clazy/blob/%1/docs/checks/README-%2.md";
|
|
|
|
|
return QString::fromLatin1(urlTemplate).arg(versionString, check);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-25 11:11:58 +02:00
|
|
|
} // namespace Internal
|
2018-03-14 12:58:12 +01:00
|
|
|
} // namespace ClangTools
|