File indexing completed on 2024-05-12 05:51:44

0001 /*  This file is part of the Kate project.
0002  *
0003  *  SPDX-FileCopyrightText: 2017 Héctor Mesa Jiménez <hector@lcc.uma.es>
0004  *
0005  *  SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #include "codeanalysisselector.h"
0009 
0010 #include "clazy.h"
0011 #include "clazycurrent.h"
0012 #include "clippy.h"
0013 #include "cppcheck.h"
0014 #include "eslint.h"
0015 #include "flake8.h"
0016 #include "shellcheck.h"
0017 
0018 QStandardItemModel *KateProjectCodeAnalysisSelector::model(QObject *parent)
0019 {
0020     auto model = new QStandardItemModel(parent);
0021 
0022     /*
0023      * available linters
0024      */
0025     const KateProjectCodeAnalysisTool *tools[] = {
0026         // cppcheck, for C++
0027         new KateProjectCodeAnalysisToolCppcheck(model),
0028         // flake8, for Python
0029         new KateProjectCodeAnalysisToolFlake8(model),
0030         // ShellCheck, for sh/bash scripts
0031         new KateProjectCodeAnalysisToolShellcheck(model),
0032         // clazy for Qt C++
0033         new KateProjectCodeAnalysisToolClazy(model),
0034         // clang-tidy
0035         new KateProjectCodeAnalysisToolClazyCurrent(model),
0036         // eslint-current-file
0037         new ESLint(model),
0038         // clippy
0039         new Clippy(model),
0040     };
0041 
0042     QList<QStandardItem *> column;
0043 
0044     for (auto tool : tools) {
0045         auto item = new QStandardItem(tool->name());
0046         item->setData(QVariant::fromValue(tool), Qt::UserRole + 1);
0047 
0048         column << item;
0049     }
0050 
0051     model->appendColumn(column);
0052 
0053     return model;
0054 }