Jump to content
Elliot Hillary

DelphiLint v1.0.0 released!

Recommended Posts

For your assets on the Releases page please, please don't use the Codenames only. I just sat in front of my Delphi with an open project and could not quickly find out if the ubiquitous number 12 represents the elusive city of Alexandria or Athens, unsure of which of your Assets to download. If you must waste space by using Codenames, then please at least waste two spaces more by adding the version you mean to address....or to satisfy my Monkness scrap the Codenames altogether.

  • Like 1

Share this post


Link to post

OK, so after a test run and wondering what took so long for a barely more than "Hello World" project... the product seems to have an issue with UNC paths. Filed it as #17

Share this post


Link to post
On 3/20/2024 at 12:11 AM, Elliot Hillary said:

installing the JRE is pretty quick and easy.

However, it might not be permitted to do so in corporate environments.

  • Like 2

Share this post


Link to post

My workmachine is not quite JRE free, due to IBM ACE.

But in general, I don't install Java apps if I can avoid it.

  • Like 2
  • Thanks 2

Share this post


Link to post
Posted (edited)
On 3/19/2024 at 5:07 AM, Elliot Hillary said:

If there's a lot of interest in customising the rules in standalone mode, that's certainly something that could make its way into a future release.

 

I definitely would appreciate customizing rules in standalone mode. I attempted installing SonarQube and going the "connected mode" route. However, I had difficulty getting the SonarQube service started and I am not a Java guy.

 

Some of the rules are more annoying than helpful. I have no idea what "naming conventions" DelphiLint is expecting. One convention seems to be that unit names must be PascalCase. Particularly for legacy projects, there is no benefit. Yes, a consistent naming convention is very helpful. Does anyone care that all of our form units follow formMain.pas rather than FormMain.pas?

 

I almost want to create an issue for the rule "split this 128 characters long line (which is greater than 120 authorized)". Authorized by who, or what? Certainly not by me, my employer, or anything that I've configured in Delphi.

 

Others are personal preferences. "Delphi style guides" may advise against using () when calling a routine without arguments. But I prefer to have them. They do no harm and I think they improve code read-ability.

 

Those are just a couple examples where the ability to customize the rules, even in standalone mode, would be appreciated.

Edited by JonRobertson
  • Like 1

Share this post


Link to post
6 hours ago, JonRobertson said:

I definitely would appreciate customizing rules in standalone mode. I attempted installing SonarQube and going the "connected mode" route. However, I had difficulty getting the SonarQube service started and I am not a Java guy.

 

Some of the rules are more annoying than helpful. I have no idea what "naming conventions" DelphiLint is expecting. One convention seems to be that unit names must be PascalCase. Particularly for legacy projects, there is no benefit. Yes, a consistent naming convention is very helpful. Does anyone care that all of our form units follow formMain.pas rather than FormMain.pas? 

 

I almost want to create an issue for the rule "split this 128 characters long line (which is greater than 120 authorized)". Authorized by who, or what? Certainly not by me, my employer, or anything that I've configured in Delphi. 

  

Others are personal preferences. "Delphi style guides" may advise against using () when calling a routine without arguments. But I prefer to have them. They do no harm and I think they improve code read-ability.

 

Those are just a couple examples where the ability to customize the rules, even in standalone mode, would be appreciated.

Sorry to hear you had issues starting up SonarQube - is it possible that the root cause is the same as #8? This part of the SonarQube documentation could be helpful.

 

By default, DelphiLint and SonarDelphi follow Delphi's Object Pascal Style Guide, so this is where the naming convention rules get their standard opinions from.
Standalone rule customization is a highly requested feature - we're tracking the proposal as #16 and are looking to add it in a future release.

Share this post


Link to post
7 minutes ago, Elliot Hillary said:

Sorry to hear you had issues starting up SonarQube - is it possible that the root cause is the same as #8? This part of the SonarQube documentation could be helpful.

It could be. I followed the instructions and was in a console window when starting the service. I don't remember anything written to the console window that would have indicated the problem was related to that issue.

 

Now that DelphiLint standalone is working, next week I may installing SonarQube again and try to get a "connected" configuration working. I still need to install our certificate in the JVM and verify that DelphiLint is able to download SonarDelphi.

 

13 minutes ago, Elliot Hillary said:

By default, DelphiLint and SonarDelphi follow Delphi's Object Pascal Style Guide, so this is where the naming convention rules get their standard opinions from.

My opinion is that naming convention is not a risk factor, which is the benefit of static analysis. Perhaps there is a risk that I am not aware of. I could see the benefit of those rules being available, just turned off by default. Another example is the default name of a "break" in a menu (main menu or popup menu). The default is "N1" for the first break, "N2" for the second, etc. Sonar suggests that I give those menu items a more meaningful name. As an experienced Delphi developer, naming it "miBreak1" is no more meaningful than "N1", because I know what they are and I don't need to reference them in code.

Share this post


Link to post

For anyone that has DelphiLint installed, I just filed ticket Issue 20 because BDS.exe was racing one logical CPU when the IDE was otherwise idle and no projects were loaded. Once I removed the Delphi Lint package, BDS.exe CPU usage dropped to 0%.

 

Delphi 11.3 (28.0.48361.3236)

DelphiLintClient-1.0.1-Alexandria.bpl

delphilint-server-1.0.1.jar

plugins\DEFAULT-sonar-delphi-1.3.0.jar

Share this post


Link to post
On 3/30/2024 at 6:46 AM, JonRobertson said:

For anyone that has DelphiLint installed, I just filed ticket Issue 20 because BDS.exe was racing one logical CPU when the IDE was otherwise idle and no projects were loaded. Once I removed the Delphi Lint package, BDS.exe CPU usage dropped to 0%.

Thanks for submitting an issue, it was only a small fix - an unoptimized background thread was wasting CPU cycles waiting for the server to start.

This issue is resolved in DelphiLint 1.0.2, along with a couple of other minor improvements.

Share this post


Link to post

I think I've discovered a problem parsing arguments.
When I try to parse the following reduzed class:

uses
  REST.Json.Types, Classes;

type
  TTest = class(TInterfacedPersistent)
  private
    [REST.Json.Types.JSONMarshalledAttribute(False)]
    FTest: Integer;
  public
    property Test: Integer read FTest write FTest;
  end;

I get the following error:

[Window Title]
Warning

[Main Instruction]
DelphiLint encountered a problem during analysis.

[Content]
An error was raised (java.lang.ClassCastException: class au.com.integradev.delphi.symbol.occurrence.NameOccurrenceImpl cannot be cast to class au.com.integradev.delphi.symbol.occurrence.AttributeNameOccurrenceImpl (au.com.integradev.delphi.symbol.occurrence.NameOccurrenceImpl and au.com.integradev.delphi.symbol.occurrence.AttributeNameOccurrenceImpl are in unnamed module of loader org.sonar.classloader.ClassRealm @57abad67)
).

[OK]

 

Share this post


Link to post

Please raise issues on the DelphiLint repository if you encounter a problem -or, if it's related to analysis problems or false positive issues, the repository for SonarDelphi (the analyzer DelphiLint uses).
Those are the centralized places we're tracking issues, and the only places we're guaranteed to be monitoring!

 

We've raised sonar-delphi#213 for this parsing error.

Share this post


Link to post
17 hours ago, Catdog said:

I think I've discovered a problem parsing arguments.
When I try to parse the following reduzed class:


uses
  REST.Json.Types, Classes;

type
  TTest = class(TInterfacedPersistent)
  private
    [REST.Json.Types.JSONMarshalledAttribute(False)]
    FTest: Integer;
  public
    property Test: Integer read FTest write FTest;
  end;

I get the following error:


[Window Title]
Warning

[Main Instruction]
DelphiLint encountered a problem during analysis.

[Content]
An error was raised (java.lang.ClassCastException: class au.com.integradev.delphi.symbol.occurrence.NameOccurrenceImpl cannot be cast to class au.com.integradev.delphi.symbol.occurrence.AttributeNameOccurrenceImpl (au.com.integradev.delphi.symbol.occurrence.NameOccurrenceImpl and au.com.integradev.delphi.symbol.occurrence.AttributeNameOccurrenceImpl are in unnamed module of loader org.sonar.classloader.ClassRealm @57abad67)
).

[OK]

 

Thanks, we'll have that fixed in the SonarDelphi analyzer soon.

In the meantime, a stopgap measure is to change your qualified name to an unqualified JSONMarshalledAttribute, which will fix the error in your scan.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×