integrated-application-development / delphilint

Delphi IDE package providing on-the-fly code analysis and linting, powered by SonarDelphi
GNU Lesser General Public License v3.0
87 stars 13 forks source link

False positives about unused variable and variable initialization #49

Closed zedxxx closed 5 months ago

zedxxx commented 5 months ago

Prerequisites

Delphi IDE version

Delphi 12.1

DelphiLint version

1.1.0

SonarDelphi version

1.6.0

SonarQube version

No response

Issue description

unit Unit1;

interface

uses
  GR32,
  GR32_Polygons,
  GR32_VectorUtils;

procedure DrawThickLine(ABitmap: TBitmap32; const AStart, AEnd: TFloatPoint; const AColor: TColor32;
  const AWidth: Integer); inline;

procedure DrawThickPolyLine(ABitmap: TBitmap32; const APoints: TArrayOfFloatPoint; const AColor: TColor32;
  const AWidth: Integer);

implementation

procedure DrawThickLine(ABitmap: TBitmap32; const AStart, AEnd: TFloatPoint; const AColor: TColor32;
  const AWidth: Integer);
var
  VLine: TArrayOfFloatPoint;
begin
  SetLength(VLine, 2);

  VLine[0] := AStart;
  VLine[1] := AEnd;

  DrawThickPolyLine(ABitmap, VLine, AColor, AWidth);
end;

procedure DrawThickPolyLine(ABitmap: TBitmap32; const APoints: TArrayOfFloatPoint;
  const AColor: TColor32; const AWidth: Integer);
var
  VPoly: TArrayOfFloatPoint;
begin
  VPoly := BuildPolyLine(APoints, AWidth);

  if not ABitmap.MeasuringMode then begin
    PolygonFS(ABitmap, VPoly, AColor);
  end;

  ABitmap.Changed(MakeRect(PolygonBounds(VPoly), rrOutside));
end;

end.

Steps to reproduce

1

Minimal Delphi code exhibiting the issue

No response

zedxxx commented 5 months ago

Sorry, wrong place. Reported here: https://github.com/integrated-application-development/sonar-delphi/issues/250