Skip to content

Commit

Permalink
Display SonarDelphi errors instead of failing scan
Browse files Browse the repository at this point in the history
  • Loading branch information
fourls committed Oct 11, 2024
1 parent 67222fc commit fac04a8
Show file tree
Hide file tree
Showing 17 changed files with 983 additions and 38 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* View Last Analysis Log option in the main DelphiLint window, which displays the analysis logs produced by SonarDelphi
for the most recent analysis.
* Status indicator in the main DelphiLint window, which prominently displays whether errors or warnings have been
produced in the most recent analysis.
* Support for wildcard project keys when configuring authorization tokens.

### Changed

* Project Options now prevents a blank server URL or project key when in Connected Mode.
* The default SonarDelphi version is now [1.10.0](https://github.com/integrated-application-development/sonar-delphi/releases/tag/v1.10.0).
* DelphiLint no longer treats SonarDelphi analysis errors as fatal errors, supporting partial analysis in much the
same way as a normal SonarDelphi scan.

### Fixed

Expand Down
5 changes: 3 additions & 2 deletions client/source/DelphiLint.Analyzer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TAnalyzerImpl = class(TInterfacedObject, IAnalyzer)
FOnAnalysisStateChanged: TEventNotifier<TAnalysisStateChangeContext>;
FServerTerminateEvent: TEvent;

procedure OnAnalyzeResult(Issues: TObjectList<TLintIssue>);
procedure OnAnalyzeResult(Issues: TObjectList<TLintIssue>; LogMessages: TArray<string>);
procedure OnAnalyzeError(Message: string);
procedure SaveIssues(Issues: TObjectList<TLintIssue>; IssuesHaveMetadata: Boolean = False);
function TryRefreshRules: Boolean;
Expand Down Expand Up @@ -432,7 +432,7 @@ procedure TAnalyzerImpl.OnAnalyzeError(Message: string);

//______________________________________________________________________________________________________________________

procedure TAnalyzerImpl.OnAnalyzeResult(Issues: TObjectList<TLintIssue>);
procedure TAnalyzerImpl.OnAnalyzeResult(Issues: TObjectList<TLintIssue>; LogMessages: TArray<string>);
var
HasMetadata: Boolean;
ProjectFile: string;
Expand Down Expand Up @@ -461,6 +461,7 @@ procedure TAnalyzerImpl.OnAnalyzeResult(Issues: TObjectList<TLintIssue>);
end;

StateChange.Files := FCurrentAnalysis.Paths;
StateChange.LogMessages := LogMessages;
StateChange.Change := ascSucceeded;
FreeAndNil(FCurrentAnalysis);
FOnAnalysisStateChanged.Notify(StateChange);
Expand Down
1 change: 1 addition & 0 deletions client/source/DelphiLint.Context.pas
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ interface

TAnalysisStateChangeContext = record
Files: TArray<string>;
LogMessages: TArray<string>;
Change: TAnalysisStateChange;
end;

Expand Down
2 changes: 2 additions & 0 deletions client/source/DelphiLint.ExternalConsts.pas
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ interface
CReleasesApiUrl = 'https://api.github.com/repos/integrated-application-development/sonar-delphi/releases';
CFaqUrl = 'https://github.com/integrated-application-development/delphilint/blob/master/docs/FAQ.md';
CTokenInfoUrl = CFaqUrl + '#how-do-i-authenticate-with-a-sonarqube-instance-in-connected-mode';
CSonarDelphiUrl = 'https://github.com/integrated-application-development/sonar-delphi';
CReportSonarDelphiIssueUrl = CSonarDelphiUrl + '/issues/new?assignees=&labels=bug%2Ctriage&template=bug_report.yml';

implementation

Expand Down
271 changes: 271 additions & 0 deletions client/source/DelphiLint.LogViewer.dfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
object LogViewerForm: TLogViewerForm
Left = 0
Top = 0
Caption = 'Analysis Log'
ClientHeight = 449
ClientWidth = 746
Color = clBtnFace
Constraints.MinHeight = 300
Constraints.MinWidth = 500
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
FormStyle = fsStayOnTop
TextHeight = 15
object BottomPanel: TPanel
Left = 0
Top = 404
Width = 746
Height = 45
Align = alBottom
TabOrder = 0
object Label3: TLabel
Left = 8
Top = 6
Width = 455
Height = 15
Caption =
'Errors or warnings may affect analysis quality, causing missing issues ' +
'or false positives.'
end
object Label4: TLabel
Left = 8
Top = 24
Width = 422
Height = 15
Caption =
'These are typically caused by malformed source files or a misconfigured ' +
'project.'
end
end
object LogListBox: TListBox
Left = 0
Top = 37
Width = 746
Height = 367
Style = lbOwnerDrawVariable
Align = alClient
BevelInner = bvLowered
BevelOuter = bvNone
BorderStyle = bsNone
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Consolas'
Font.Style = []
ItemHeight = 14
MultiSelect = True
ParentFont = False
PopupMenu = LogPopup
TabOrder = 1
StyleElements = [seBorder]
OnDrawItem = LogListBoxDrawItem
OnMeasureItem = LogListBoxMeasureItem
end
object TopPanel: TPanel
Left = 0
Top = 0
Width = 746
Height = 37
Align = alTop
TabOrder = 2
DesignSize = (
746
37)
object TitleLabel: TLabel
Left = 10
Top = 11
Width = 182
Height = 15
Caption = 'HH:MM analysis - SonarDelphi log'
end
object ReportButton: TBitBtn
Left = 566
Top = 6
Width = 165
Height = 25
Anchors = [akTop, akRight]
Caption = 'Report a bug on GitHub'
ImageIndex = 0
Images = IconImageList
TabOrder = 0
OnClick = ReportButtonClick
end
object SaveButton: TButton
Left = 463
Top = 6
Width = 97
Height = 25
Anchors = [akTop, akRight]
Caption = 'Save log file'
TabOrder = 1
OnClick = SaveButtonClick
end
end
object SaveDialog: TSaveTextFileDialog
DefaultExt = '.log'
Encodings.Strings = (
'UTF-8'
'ANSI'
'ASCII')
Left = 320
Top = 224
end
object IconImageList: TImageList
Left = 424
Top = 264
Bitmap = {
494C010101000800040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
0000000000000000000000000000000000000000000000000000000000000000
0000000000003D393600FFFFFF00FFFFFF00FFFFFF00FFFFFF003D3936000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000003D39
36002E2924002E292400FFFFFF00FFFFFF00FFFFFF00FFFFFF002E2924002E29
24003D3936000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000003D3936002E29
2400EBEBEA00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF002E2924002E29
24002E2924003D39360000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000003D3936002E292400EBEB
EA00B0AFAF00B0AFAF00EBEBEA00FFFFFF00FFFFFF00EBEBEA002E2924002E29
24002E2924002E2924003D393600000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000002E292400EBEBEA00B0AF
AF002E292400B0AFAF00EBEBEA00FFFFFF00FFFFFF00EBEBEA009B9A9A003D39
36002E2924002E2924002E292400000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000003D3936002E2924002E2924002E29
2400EBEBEA00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00EBEB
EA00767573002E2924002E2924003D3936000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000002E2924002E2924002E292400DDDD
DC00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00EBEBEA002E2924002E2924002E2924000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000002E2924002E29240085848300FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00858483002E2924002E2924000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000002E2924002E29240085848300FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00858483002E2924002E2924000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000002E2924002E2924002E292400EBEB
EA00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00EBEBEA002E2924002E2924002E2924000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000003D3936002E2924002E292400B0AF
AF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00B0AFAF002E2924002E2924003D3936000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000002E2924002E292400B0AF
AF00FFFFFF00FFFFFF00EBEBEA00FFFFFF00FFFFFF00EBEBEA00FFFFFF00FFFF
FF00B0AFAF002E2924002E292400000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000003D3936002E2924008584
8300B0AFAF00858483002E29240085848300858483002E29240085848300B0AF
AF00858483002E2924003D393600000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000003D3936002E29
24002E2924002E2924002E2924002E2924002E2924002E2924002E2924002E29
24002E2924003D39360000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000003D39
36002E2924002E2924002E2924002E2924002E2924002E2924002E2924002E29
24003D3936000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000003D3936002E2924002E2924002E2924002E2924003D3936000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000100000000100010000000000800000000000000000000000
000000000000000000000000FFFFFF00F81F000000000000E007000000000000
C003000000000000800100000000000080010000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000080010000000000008001000000000000C003000000000000
E007000000000000F81F00000000000000000000000000000000000000000000
000000000000}
end
object LogPopup: TPopupMenu
Left = 672
Top = 320
object CopyItem: TMenuItem
Caption = '&Copy'
OnClick = CopyItemClick
end
object SaveItem: TMenuItem
Caption = '&Save'
OnClick = SaveItemClick
end
end
end
Loading

0 comments on commit fac04a8

Please sign in to comment.