File indexing completed on 2024-04-28 04:38:10
0001 /* 0002 SPDX-FileCopyrightText: 2016 Carlos Nihelton <carlosnsoliveira@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef CLANGTIDY_PLUGIN_H 0008 #define CLANGTIDY_PLUGIN_H 0009 0010 // plugin 0011 #include "checkset.h" 0012 // KDevPlatform 0013 #include <interfaces/iplugin.h> 0014 0015 namespace ClangTidy 0016 { 0017 class Analyzer; 0018 class CheckSetSelectionManager; 0019 0020 /** 0021 * \class 0022 * \brief implements the support for clang-tidy inside KDevelop by using the IPlugin interface. 0023 */ 0024 class Plugin : public KDevelop::IPlugin 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 explicit Plugin(QObject* parent, const QVariantList& = QVariantList()); 0030 ~Plugin() override; 0031 0032 public: // KDevelop::IPlugin API 0033 void unload() override; 0034 KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override; 0035 int configPages() const override { return 1; } 0036 /** 0037 * \function 0038 * \return the session configuration page for clang-tidy plugin. 0039 */ 0040 KDevelop::ConfigPage* configPage(int number, QWidget* parent) override; 0041 int perProjectConfigPages() const override { return 1; } 0042 /** 0043 * \function 0044 * \return the clang-tidy configuration page for the current project. 0045 */ 0046 KDevelop::ConfigPage* perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, 0047 QWidget* parent) override; 0048 0049 public: 0050 /** 0051 *\function 0052 *\returns all available checks, obtained from clang-tidy program, ran with "--checks=* --list-checks" 0053 * parameters. 0054 */ 0055 QStringList allAvailableChecks() { return m_checkSet.all(); } 0056 CheckSet& checkSet() { return m_checkSet; } 0057 0058 private: 0059 Analyzer* m_analyzer; 0060 CheckSet m_checkSet; 0061 CheckSetSelectionManager* m_checkSetSelectionManager; 0062 }; 0063 0064 } // namespace ClangTidy 0065 0066 #endif // CLANGTIDY_PLUGIN_H