- Suche nach toten Funktionen im Projekt - Doppelklick auf Funktion öffnet die Datei mit der Deklaration
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
#pragma once
|
||
|
||
#include <QObject>
|
||
#include <QString>
|
||
#include <QStringList>
|
||
#include <QList>
|
||
|
||
#include "FunctionScanner.h"
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// DeadCodeAnalyzer – Findet Funktionen die definiert aber nie aufgerufen werden.
|
||
// ---------------------------------------------------------------------------
|
||
class DeadCodeAnalyzer : public QObject
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
struct DeadFunction
|
||
{
|
||
FunctionScanner::FunctionInfo info;
|
||
QString reason;
|
||
};
|
||
|
||
explicit DeadCodeAnalyzer(QObject *parent = nullptr);
|
||
|
||
// excludeDirs: Verzeichnisnamen die komplett übersprungen werden
|
||
// z.B. {"vendor", "lib", "node_modules"}
|
||
QList<DeadFunction> analyze(const QString &projectRoot,
|
||
const QStringList &extensions = {"*.php"},
|
||
const QStringList &excludeDirs = {}) const;
|
||
|
||
signals:
|
||
// Fortschritt während der Analyse (läuft im Thread)
|
||
void progressUpdate(int filesScanned, int filesTotal,
|
||
const QString ¤tFile) const;
|
||
|
||
private:
|
||
FunctionScanner *m_scanner = nullptr;
|
||
};
|