-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Prerequisites
- This bug is in SonarDelphi, not SonarQube or my Delphi code.
- This bug has not already been reported.
SonarDelphi version
1.15.0
Delphi version
10.4
SonarQube version
10.7
Issue description
We are having hundreds of this false positive, on constants, but also on other elements.
The problem isn't easy to replicate, some time the problem disappear, apparently without intentional changes.
I was able to isolate the problem in the attached unit.
In this specific case, constant declared in line 7, is used in line 50.
Steps to reproduce
execute code analysis on the attached unit.
Minimal Delphi code exhibiting the issue
unit SistemaFrm;
interface
const
CM_CREATE_RECUR = WM_USER + 10000;
type
TcxCheckGroupAccess = class(TcxCheckGroup);
TSistemaForm = class(TAnagForm, IDckExplorerChildForm)
procedure AggiuntiSingoliEventiRipetitivi( AEvent: TcxSchedulerControlEvent);
end;
var
SistemaForm : TSistemaForm;
aNewEvent : Boolean;
implementation
{$R *.dfm}
procedure TSistemaForm.AggiuntiSingoliEventiRipetitivi( AEvent: TcxSchedulerControlEvent);
var
afield : Variant;
begin
if not Assigned(AEvent) then // event deleted or not created
Exit;
if AEvent <> Nil then
try
if True then begin
inherited;
// Aggiorno la descrizione dell'evento con il codice del punto di prelievo
//afield := aEvent.GetCustomFieldValueByName('cal_ptoPrelievo');
if Not(Varisnull(Afield))
then aEvent.Caption := aField
else ;
if AEvent.IsRecurring and (AEvent.EventType = etPattern) then Begin// Is the parent event
// Prima inserisco l'evento padre ... e poi inserisco tutte le sue occorrenze
aEvent.Caption := aField;
//aEvent.AllDayEvent := False;
PostMessage( Self.Handle, CM_CREATE_RECUR, 0, AEvent.ID);
end
end;
Finally
end;
end;
begin
registerclass(TSistemaForm);
end.
