Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EmptyBlock raises issue on empty anonymous methods, but EmptyRoutine does not #315

Open
2 tasks done
fourls opened this issue Nov 18, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@fourls
Copy link
Collaborator

fourls commented Nov 18, 2024

Prerequisites

  • This bug is in SonarDelphi, not SonarQube or my Delphi code.
  • This bug has not already been reported.

SonarDelphi version

1.11.0

SonarQube version

No response

Issue description

EmptyBlock currently raises an issue on an empty anonymous method, while EmptyRoutine (which should) does not.

For example, the following raises a single EmptyBlock issue:

MyProcedure := procedure begin
    // I am empty for a reason!
  end;

This should be ignored by EmptyBlock, since the description states:

Exceptions

  • Empty routine bodies (covered by the EmptyRoutine rule)

EmptyRoutine, on the other hand, should pick this up.

Steps to reproduce

Scan the following code with SonarDelphi:

unit Test;

interface

implementation

uses System.SysUtils;

function GetDummyProc: TProc;
begin
  Result := procedure begin
      // I am empty for a reason
    end;
end;

end.

Minimal Delphi code exhibiting the issue

No response

@fourls fourls added the bug Something isn't working label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant