Skip to content

Commit ca9a7a1

Browse files
committed
feat(standalone): full export menu via shared TFindingExportMenu
uIDEExportMenu had no OTA/IDE-specific dependencies despite the name - just standard VCL plus our export units. Moved + renamed it to a shared location so the Standalone GUI can reuse the same popup menu the IDE plugin ships: StaticCodeAnalyserIDE/uIDEExportMenu.pas -> StaticCodeAnalyserForm/sources/UI/uExportMenu.pas The class TFindingExportMenu stays as-is (already neutral, no rename needed). Constructor takes only callbacks (Status, GetGrid, GetBaseDir) so the Standalone wires its own getters without touching the menu code. Standalone Form (uMainForm) now: - declares FExportMenu : TFindingExportMenu - declares FBtnExport : TButton (runtime-created next to BtnBranch) - adds GetResultGrid / GetCurrentBaseDir / StatusModeProc helpers - imports uExportMenu in the implementation uses - in FormCreate: create button + menu + AttachToButton The Export button shows "Export ▼" with a tooltip listing all formats. Clicking opens the same popup the IDE plugin uses: HTML report (all findings)... JSON... CSV... --- Jira markup -> Clipboard Plain text -> Clipboard --- Sonar: write Generic Issue report (all findings)... Sonar: send selected as external issue IDE plugin + IDE .dpk + IDE .dproj updated to use the new path. Standalone .dpr + .dproj add the DCCReference. README + README_de matrix updated EN+DE: Standalone now shows ✅ for HTML / Sonar / CSV / JSON / Jira (was — / GUI-only before).
1 parent 23b3867 commit ca9a7a1

9 files changed

Lines changed: 67 additions & 22 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ different workflow. Pick by where you sit in the day:
112112
| **Analyse a project outside Delphi** (RAD not installed / batch machine) || ✅ pick a folder, click Start |`analyser.exe <folder>` |
113113
| **Run as a pre-commit hook** |||`--min-severity error --quiet --fail-on error`, exit code reflects severity |
114114
| **Run in CI / GitHub Actions** |||`--report-sarif sca.sarif`, SARIF upload step |
115-
| **Push findings to SonarQube / SonarCloud** |`Tools → Sonar Push` | |`--sonar-export sca-findings.json --sonar-host <url> --sonar-token <t>` |
116-
| **Generate an HTML report** for stakeholders / Jira attachments | ✅ Export → HTML | ||
115+
| **Push findings to SonarQube / SonarCloud** |`Tools → Sonar Push` | ✅ Export → Sonar |`--sonar-export sca-findings.json --sonar-host <url> --sonar-token <t>` |
116+
| **Generate an HTML report** for stakeholders / Jira attachments | ✅ Export → HTML | ✅ Export → HTML ||
117117
| **Generate a Claude review prompt** for the whole batch (Tech-Lead workflow) | ✅ Export → Claude prompt | row-click → clipboard ||
118-
| **CSV export** of the current finding list | ✅ Export → CSV |"Save CSV" button | ✅ (delegates to the same writer) |
118+
| **CSV / JSON / Jira export** of findings | ✅ Export menu |Export menu | ✅ (CSV/JSON via flags) |
119119
| **Nightly full-repo scan** + diff-against-baseline || ✅ schedule via Task Scheduler | ✅ schedule via `cron` / `schtasks` |
120120
| **Auto-analyse on file save** (Live-Watch) | ✅ opt-in, see [Live-Watch](#live-watch-ide-plugin-only--%EF%B8%8F-risky) |||
121121
| **Author / edit custom rules** (RegEx via `[CustomRules]` ini) | ✅ Tools → Options | ✅ Settings dialog | edit `analyser.ini` directly |

README_de.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ anderen Workflow. Wahl nach Rolle / Tageszeit:
112112
| **Projekt außerhalb von Delphi analysieren** (kein RAD installiert / Batch-Maschine) || ✅ Ordner wählen, Start klicken |`analyser.exe <ordner>` |
113113
| **Als Pre-Commit-Hook ausführen** |||`--min-severity error --quiet --fail-on error`, Exit-Code reflektiert Severity |
114114
| **In CI / GitHub Actions ausführen** |||`--report-sarif sca.sarif`, SARIF-Upload-Step |
115-
| **Befunde an SonarQube / SonarCloud pushen** |`Tools → Sonar Push` | |`--sonar-export sca-findings.json --sonar-host <url> --sonar-token <t>` |
116-
| **HTML-Report generieren** für Stakeholder / Jira-Anhang | ✅ Export → HTML | ||
115+
| **Befunde an SonarQube / SonarCloud pushen** |`Tools → Sonar Push` | ✅ Export → Sonar |`--sonar-export sca-findings.json --sonar-host <url> --sonar-token <t>` |
116+
| **HTML-Report generieren** für Stakeholder / Jira-Anhang | ✅ Export → HTML | ✅ Export → HTML ||
117117
| **Claude-Review-Prompt** für gesamten Batch (Tech-Lead-Workflow) | ✅ Export → Claude-Prompt | Zeilen-Klick → Clipboard ||
118-
| **CSV-Export** der aktuellen Befund-Liste | ✅ Export → CSV |"CSV speichern"-Button | ✅ (delegiert auf den gleichen Writer) |
118+
| **CSV / JSON / Jira-Export** der Befunde | ✅ Export-Menü |Export-Menü | ✅ (CSV/JSON via Switches) |
119119
| **Nightly Full-Repo-Scan** + Diff gegen Baseline || ✅ Task Scheduler |`cron` / `schtasks` |
120120
| **Auto-Analyse beim Speichern** (Live-Watch) | ✅ opt-in, siehe [Live-Watch](#live-watch-nur-ide-plugin--%EF%B8%8F-riskant) |||
121121
| **Custom-Rules editieren** (RegEx via `[CustomRules]`-ini) | ✅ Tools → Options | ✅ Einstellungsdialog | `analyser.ini` direkt editieren |

StaticCodeAnalyserForm/StaticCodeAnalyser.d12.dpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ uses
5454
uOrderForm in 'resources\uOrderForm.pas' {OrderForm},
5555
uIDEStatsTiles in 'sources\UI\uIDEStatsTiles.pas',
5656
uIDEHelpPanel in 'sources\UI\uIDEHelpPanel.pas',
57+
uExportMenu in 'sources\UI\uExportMenu.pas',
5758
ConcatToFormatSample in 'resources\ConcatToFormatSample.pas',
5859
WithStatementSample in 'resources\WithStatementSample.pas',
5960
uAstFileCache in 'sources\Infrastructure\uAstFileCache.pas',

StaticCodeAnalyserForm/StaticCodeAnalyser.d12.dproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
</DCCReference>
189189
<DCCReference Include="sources\UI\uIDEStatsTiles.pas"/>
190190
<DCCReference Include="sources\UI\uIDEHelpPanel.pas"/>
191+
<DCCReference Include="sources\UI\uExportMenu.pas"/>
191192
<DCCReference Include="resources\ConcatToFormatSample.pas"/>
192193
<DCCReference Include="resources\WithStatementSample.pas"/>
193194
<DCCReference Include="sources\Infrastructure\uAstFileCache.pas"/>

StaticCodeAnalyserIDE/uIDEExportMenu.pas renamed to StaticCodeAnalyserForm/sources/UI/uExportMenu.pas

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
unit uIDEExportMenu;
1+
unit uExportMenu;
22

3-
// Export-Popup-Menue des Analyser-Frame-Plugins:
4-
// HTML-Report, JSON, CSV (alle drei via Save-Dialog) plus Jira-Wiki-
5-
// Markup und Plain-Text-Befunde in die Zwischenablage.
3+
// Export-Popup-Menue. Geteilt zwischen IDE-Plugin-Frame und Standalone-
4+
// Form (keine OTA-/IDE-spezifischen Dependencies; nur VCL + Export-Units).
65
//
7-
// Vorher: 6 Click-Handler (~210 Zeilen) + ~16 Zeilen Menu-Setup direkt
8-
// in der God-Class TAnalyserFrame, plus die Frame-Methode CurrentFocusFile
9-
// die nur von Jira/Clipboard-Export gebraucht wurde.
6+
// HTML-Report, JSON, CSV (alle drei via Save-Dialog) plus Jira-Wiki-
7+
// Markup und Plain-Text-Befunde in die Zwischenablage, plus Sonar-
8+
// Generic-Issue-Report und Single-Issue-Push.
109
//
11-
// Jetzt: alles gekapselt in TFindingExportMenu. Frame haelt nur noch
12-
// einen Field-Reference + ruft AttachToButton beim UI-Setup. Die
13-
// Findings-Listen + das Grid werden by-reference durchgereicht (kein
14-
// Ownership-Transfer); StatusMode + GetBaseDir sind Method-References
15-
// auf den Frame, sodass Live-Werte gelesen werden, nicht eingefroren
16-
// zur Construct-Zeit.
10+
// Caller haelt einen Field-Reference + ruft AttachToButton beim
11+
// UI-Setup. Die Findings-Listen + das Grid werden by-reference
12+
// durchgereicht (kein Ownership-Transfer); StatusMode + GetBaseDir
13+
// sind Method-References auf den Caller, sodass Live-Werte gelesen
14+
// werden, nicht eingefroren zur Construct-Zeit.
1715

1816
interface
1917

StaticCodeAnalyserForm/sources/UI/uMainForm.pas

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ interface
1111
uMethodd12, uSCAConsts, uFixHint, uClaudePrompt, uLocalization,
1212
uRepoSettings, uRecentPaths, uFindingGridRenderer, uDfmTextViewer,
1313
uIDEHelpPanel, // TFindingHintPanel (im class-Feld referenziert)
14+
uExportMenu, // TFindingExportMenu (Class-Field-Reference)
1415
Vcl.Controls
1516
;
1617

@@ -91,6 +92,14 @@ TForm2 = class(TForm)
9192
// Hint-Panel rechts vom Grid (Before/After-Code-Beispiele).
9293
// Standalone-Modus: AlwaysVisible=True (kein Auto-Hide).
9394
FHintPanel : TFindingHintPanel;
95+
// Geteilter Export-Menu-Helper (HTML / JSON / CSV / Jira / Clipboard
96+
// / Sonar-Generic / Sonar-Push). Identisch zum IDE-Plugin.
97+
FExportMenu : TFindingExportMenu;
98+
FBtnExport : TButton;
99+
// Getter / Callback fuer den FExportMenu-Konstruktor.
100+
function GetResultGrid: TStringGrid;
101+
function GetCurrentBaseDir: string;
102+
procedure StatusModeProc(const Msg: string);
94103
// Progress-Feedback waehrend Analyse (analog zum IDE-Plugin).
95104
// ProgressBar in der StatusBar eingebettet, Cancel-Button daneben.
96105
// Werden zur Laufzeit erzeugt - kein DFM-Eintrag noetig.
@@ -312,6 +321,24 @@ procedure TForm2.FormCreate(Sender: TObject);
312321
// 1/3-Breite anpasst (und die Vorher/Nachher-Aufteilung neu rechnet).
313322
Self.OnResize := FormResizeHandler;
314323

324+
// ---- Export-Button + geteiltes Popup-Menu (HTML / JSON / CSV / Jira /
325+
// Clipboard / Sonar-Generic / Sonar-Push). Selbe Implementierung
326+
// wie im IDE-Plugin via uExportMenu.TFindingExportMenu.
327+
FBtnExport := TButton.Create(Self);
328+
FBtnExport.Parent := PanelActions; // gleiche Toolbar wie Analyse-Buttons
329+
FBtnExport.Left := BtnBranch.Left + BtnBranch.Width + 12;
330+
FBtnExport.Top := BtnBranch.Top;
331+
FBtnExport.Width := 90;
332+
FBtnExport.Height := BtnBranch.Height;
333+
FBtnExport.Caption := _('Export') + ' ' + Char($25BC); // "▼"
334+
FBtnExport.Hint := _('Export findings: HTML / JSON / CSV / Jira / ' +
335+
'Clipboard / Sonar');
336+
FBtnExport.ShowHint := True;
337+
FExportMenu := TFindingExportMenu.Create(Self,
338+
FAllFindings, FDisplayedFindings,
339+
GetResultGrid, StatusModeProc, GetCurrentBaseDir);
340+
FExportMenu.AttachToButton(FBtnExport);
341+
315342
// ---- ProgressBar + Cancel-Button in der StatusBar (Laufzeit-Widgets)
316343
// Layout: Cancel-Button rechts am StatusBar-Rand (alRight, Width=80),
317344
// ProgressBar fuellt den restlichen Platz (alClient). Beide werden in
@@ -445,6 +472,24 @@ procedure TForm2.FormResizeHandler(Sender: TObject);
445472
if Assigned(FHintPanel) then FHintPanel.ApplyLayout;
446473
end;
447474

475+
// Getter / Callbacks fuer FExportMenu. Live-Reads damit das Menu
476+
// gegen die aktuellen Frame-Felder arbeitet, nicht gegen
477+
// Construct-Zeit-Snapshots.
478+
function TForm2.GetResultGrid: TStringGrid;
479+
begin
480+
Result := ResultGrid;
481+
end;
482+
483+
function TForm2.GetCurrentBaseDir: string;
484+
begin
485+
Result := FCurrentBaseDir;
486+
end;
487+
488+
procedure TForm2.StatusModeProc(const Msg: string);
489+
begin
490+
StatusBar1.Panels[2].Text := Msg;
491+
end;
492+
448493
procedure TForm2.FormDestroy(Sender: TObject);
449494
begin
450495
// Globalen Application.OnShowHint loesen damit kein dangling Methodenzeiger

StaticCodeAnalyserIDE/StaticCodeAnalyser.IDE.d12.dpk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ contains
4343
uIDEWatchMode in 'uIDEWatchMode.pas',
4444
uIDEStatsTiles in '..\StaticCodeAnalyserForm\sources\UI\uIDEStatsTiles.pas',
4545
uIDEHelpPanel in '..\StaticCodeAnalyserForm\sources\UI\uIDEHelpPanel.pas',
46-
uIDEExportMenu in 'uIDEExportMenu.pas',
46+
uExportMenu in '..\StaticCodeAnalyserForm\sources\UI\uExportMenu.pas',
4747
uIDEEditorIntegration in 'uIDEEditorIntegration.pas',
4848
uIDEStatusBar in 'uIDEStatusBar.pas',
4949
uIDEThemeIntegration in 'uIDEThemeIntegration.pas',

StaticCodeAnalyserIDE/StaticCodeAnalyser.IDE.d12.dproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
<DCCReference Include="uIDEWatchMode.pas"/>
172172
<DCCReference Include="..\StaticCodeAnalyserForm\sources\UI\uIDEStatsTiles.pas"/>
173173
<DCCReference Include="..\StaticCodeAnalyserForm\sources\UI\uIDEHelpPanel.pas"/>
174-
<DCCReference Include="uIDEExportMenu.pas"/>
174+
<DCCReference Include="..\StaticCodeAnalyserForm\sources\UI\uExportMenu.pas"/>
175175
<DCCReference Include="uIDEEditorIntegration.pas"/>
176176
<DCCReference Include="uIDEStatusBar.pas"/>
177177
<DCCReference Include="uIDEThemeIntegration.pas"/>

StaticCodeAnalyserIDE/uIDEAnalyserForm.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface
2121
uAnalyserPalette, uAnalyserTypes, uAnalyserTheme, uLocalization,
2222
uRecentPaths,
2323
uIDELineHighlighter, uIDEMessages, uIDEWatchMode, uIDEStatsTiles,
24-
uIDEHelpPanel, uIDEExportMenu, uIDEEditorIntegration, uIDEStatusBar,
24+
uIDEHelpPanel, uExportMenu, uIDEEditorIntegration, uIDEStatusBar,
2525
uIDEThemeIntegration, uIDEAnalyseProgress, uIDEGridTooltip,
2626
uIDELifecycle, uIDEAnalyseRunner,
2727
uIDEAnnotationOverlay,

0 commit comments

Comments
 (0)