diff --git a/addons/project/CMakeLists.txt b/addons/project/CMakeLists.txt --- a/addons/project/CMakeLists.txt +++ b/addons/project/CMakeLists.txt @@ -25,6 +25,7 @@ kateprojectconfigpage.cpp kateprojectcodeanalysistool.cpp tools/kateprojectcodeanalysistoolcppcheck.cpp + tools/kateprojectcodeanalysistoolcppcheck2.cpp tools/kateprojectcodeanalysistoolflake8.cpp tools/kateprojectcodeanalysistoolshellcheck.cpp tools/kateprojectcodeanalysisselector.cpp diff --git a/addons/project/tools/kateprojectcodeanalysisselector.cpp b/addons/project/tools/kateprojectcodeanalysisselector.cpp --- a/addons/project/tools/kateprojectcodeanalysisselector.cpp +++ b/addons/project/tools/kateprojectcodeanalysisselector.cpp @@ -21,6 +21,7 @@ #include "kateprojectcodeanalysisselector.h" #include "kateprojectcodeanalysistoolcppcheck.h" +#include "kateprojectcodeanalysistoolcppcheck2.h" #include "kateprojectcodeanalysistoolflake8.h" #include "kateprojectcodeanalysistoolshellcheck.h" @@ -32,11 +33,9 @@ * available linters */ const QList tools = { - // cppcheck, for C++ new KateProjectCodeAnalysisToolCppcheck(model), - // flake8, for Python + new KateProjectCodeAnalysisToolCppcheck2(model), new KateProjectCodeAnalysisToolFlake8(model), - // ShellCheck, for sh/bash scripts new KateProjectCodeAnalysisToolShellcheck(model) }; diff --git a/addons/project/tools/kateprojectcodeanalysistoolcppcheck.cpp b/addons/project/tools/kateprojectcodeanalysistoolcppcheck.cpp --- a/addons/project/tools/kateprojectcodeanalysistoolcppcheck.cpp +++ b/addons/project/tools/kateprojectcodeanalysistoolcppcheck.cpp @@ -36,7 +36,7 @@ QString KateProjectCodeAnalysisToolCppcheck::name() { - return i18n("Cppcheck (C++)"); + return i18n("Cppcheck (C/C++)"); } QString KateProjectCodeAnalysisToolCppcheck::description() diff --git a/addons/project/tools/kateprojectcodeanalysistoolcppcheck2.h b/addons/project/tools/kateprojectcodeanalysistoolcppcheck2.h new file mode 100644 --- /dev/null +++ b/addons/project/tools/kateprojectcodeanalysistoolcppcheck2.h @@ -0,0 +1,43 @@ +/* This file is part of the Kate project. + * + * Copyright (C) 2018 Gregor Mi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#pragma once + +#include "kateprojectcodeanalysistoolcppcheck.h" + +/** + * Information provider for Cppcheck (C++ only) + */ +class KateProjectCodeAnalysisToolCppcheck2 : public KateProjectCodeAnalysisToolCppcheck +{ +public: + explicit KateProjectCodeAnalysisToolCppcheck2(QObject *parent = nullptr); + + virtual ~KateProjectCodeAnalysisToolCppcheck2() override; + + virtual QString name() override; + + virtual QString description() override; + + virtual QString fileExtensions() override; + + virtual QStringList arguments() override; +}; + diff --git a/addons/project/tools/kateprojectcodeanalysistoolcppcheck2.cpp b/addons/project/tools/kateprojectcodeanalysistoolcppcheck2.cpp new file mode 100644 --- /dev/null +++ b/addons/project/tools/kateprojectcodeanalysistoolcppcheck2.cpp @@ -0,0 +1,65 @@ +/* This file is part of the Kate project. + * + * Copyright (C) 2018 Gregor Mi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "kateprojectcodeanalysistoolcppcheck2.h" + +#include +#include + +KateProjectCodeAnalysisToolCppcheck2::KateProjectCodeAnalysisToolCppcheck2(QObject *parent) + : KateProjectCodeAnalysisToolCppcheck(parent) +{ + +} + +KateProjectCodeAnalysisToolCppcheck2::~KateProjectCodeAnalysisToolCppcheck2() +{ + +} + +QString KateProjectCodeAnalysisToolCppcheck2::name() +{ + return i18n("Cppcheck (C++ only)"); +} + +QString KateProjectCodeAnalysisToolCppcheck2::description() +{ + return i18n("Cppcheck with --language=c++. Filtered files also contain header files which might find more issues."); +} + +QString KateProjectCodeAnalysisToolCppcheck2::fileExtensions() +{ + return QStringLiteral("h|hpp|cpp|cxx|cc|c++|c|tpp|txx"); +} + +QStringList KateProjectCodeAnalysisToolCppcheck2::arguments() +{ + QStringList _args; + + _args << QStringLiteral("-q") + << QStringLiteral("--language=c++") + << QStringLiteral("--inline-suppr") + << QStringLiteral("--enable=all") + << QStringLiteral("--template={file}////{line}////{severity}////{message}") + << QStringLiteral("--file-list=-"); + + return _args; +} + diff --git a/kate/katemainwindow.h b/kate/katemainwindow.h --- a/kate/katemainwindow.h +++ b/kate/katemainwindow.h @@ -365,17 +365,6 @@ return true; } - /** - * Close the split view where the given view is contained. - * \param view the view. - * \return true if the split view was closed. - */ - bool closeSplitView(KTextEditor::View *view) - { - m_viewManager->closeViewSpace(view); - return true; - } - /** * @returns true if the two given views share the same split view, * false otherwise.