File indexing completed on 2024-04-21 04:38:10
0001 /* 0002 SPDX-FileCopyrightText: 2018 Anton Anikin <anton@anikin.xyz> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVCLAZY_JOB_H 0008 #define KDEVCLAZY_JOB_H 0009 0010 // CompileAnalyzer 0011 #include <compileanalyzejob.h> 0012 // KDevPlatform 0013 #include <interfaces/iproblem.h> 0014 #include <outputview/outputexecutejob.h> 0015 0016 class QElapsedTimer; 0017 0018 namespace Clazy 0019 { 0020 0021 class ChecksDB; 0022 0023 class JobParameters 0024 { 0025 public: 0026 QString executablePath; 0027 QUrl url; 0028 QStringList filePaths; 0029 QString buildDir; 0030 0031 QString checks; 0032 0033 bool onlyQt = false; 0034 bool qtDeveloper = false; 0035 bool qt4Compat = false; 0036 bool visitImplicitCode = false; 0037 bool ignoreIncludedFiles = false; 0038 0039 QString headerFilter; 0040 0041 bool enableAllFixits = false; 0042 bool noInplaceFixits = false; 0043 0044 QString extraAppend; 0045 QString extraPrepend; 0046 QString extraClazy; 0047 0048 bool verboseOutput = false; 0049 int parallelJobCount = 1; 0050 }; 0051 0052 class Job : public KDevelop::CompileAnalyzeJob 0053 { 0054 Q_OBJECT 0055 0056 protected: 0057 /// Empty constructor which creates invalid Job instance. Used only for testing 0058 Job(); 0059 0060 public: 0061 Job(const JobParameters& params, QSharedPointer<const ChecksDB> db); 0062 ~Job() override; 0063 0064 public: // KJob API 0065 void start() override; 0066 0067 protected Q_SLOTS: 0068 void postProcessStdout(const QStringList& lines) override; 0069 void postProcessStderr(const QStringList& lines) override; 0070 0071 void childProcessExited(int exitCode, QProcess::ExitStatus exitStatus) override; 0072 void childProcessError(QProcess::ProcessError processError) override; 0073 0074 protected: 0075 void processStdoutLines(const QStringList& lines); 0076 void processStderrLines(const QStringList& lines); 0077 0078 private: 0079 QSharedPointer<const ChecksDB> m_db; 0080 QScopedPointer<QElapsedTimer> m_timer; 0081 0082 QStringList m_standardOutput; 0083 QStringList m_stderrOutput; 0084 }; 0085 0086 } 0087 #endif