ClangTools: Run clang-tidy and clazy separately

They are two different tools and should not have been merged into a
single runner in the first place.
People can now actively decide to run clazy if they really want to,
rather than getting confronted with its increasingly irrelevant
complaints by default.
We keep the common settings widget for now.

Change-Id: I3c2b1db8c07ff5c128700d4a1deefd710967568a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-12-07 14:49:35 +01:00
parent ca6b14cf01
commit 8b49b091f7
10 changed files with 159 additions and 114 deletions

View File

@@ -46,17 +46,11 @@ class DiagnosticView;
class RunSettings;
class SelectFixitsCheckBox;
const char ClangTidyClazyPerspectiveId[] = "ClangTidyClazy.Perspective";
class ClangTool : public QObject
{
Q_OBJECT
public:
static ClangTool *instance();
ClangTool();
void selectPerspective();
enum class FileSelectionType {
@@ -93,6 +87,9 @@ public:
signals:
void finished(const QString &errorText); // For testing.
protected:
ClangTool(const QString &name, Utils::Id id);
private:
enum class State {
Initial,
@@ -132,6 +129,7 @@ private:
FileInfoProviders fileInfoProviders(ProjectExplorer::Project *project,
const FileInfos &allFileInfos);
const QString m_name;
ClangToolsDiagnosticModel *m_diagnosticModel = nullptr;
ProjectExplorer::RunControl *m_runControl = nullptr;
ClangToolRunWorker *m_runWorker = nullptr;
@@ -161,11 +159,27 @@ private:
QAction *m_clear = nullptr;
QAction *m_expandCollapse = nullptr;
Utils::Perspective m_perspective{ClangTidyClazyPerspectiveId,
::ClangTools::Internal::ClangTool::tr("Clang-Tidy and Clazy")};
Utils::Perspective m_perspective;
};
class ClangTidyTool : public ClangTool
{
public:
ClangTidyTool();
static ClangTool *instance() { return m_instance; }
private:
const QString m_name;
static inline ClangTool *m_instance = nullptr;
};
class ClazyTool : public ClangTool
{
public:
ClazyTool();
static ClangTool *instance() { return m_instance; }
private:
static inline ClangTool *m_instance = nullptr;
};
} // namespace Internal