Jump to content
Elliot Hillary

DelphiLint v1.0.0 released!

Recommended Posts

image.png.5303cf8eab4a7e11b7806aff5154884e.png

We're excited to announce the release of DelphiLint v1.0.0, a free and open-source static analyzer and linter for the Delphi IDE!

 

DelphiLint is powered by SonarDelphi, our Delphi analyzer for the SonarQube code quality platform that scans entire codebases with more than 120 different rules.
With DelphiLint, the feedback loop is shortened - it allows you to analyze individual files within your editor and correct problems before they're even checked in.

 

GitHub: https://github.com/integrated-application-development/delphilint

Release: https://github.com/integrated-application-development/delphilint/releases/tag/v1.0.0

 

Features

  • Analyze one or more files on demand
  • View detected issues, descriptions, and rationale inline in the Delphi IDE
  • Two analysis modes:
    • Standalone - run analyses entirely locally with a default set of active rules
    • Connected - connect to a SonarQube instance, allowing for
      • Fetching of active rules and configuration from the server's configured quality profiles
      • Suppression of issues that have been resolved in past analyses
      • Usage of the server's version of SonarDelphi
  • Uses the same rules and configuration files as SonarDelphi, making configuration easy for projects that already use SonarDelphi for code quality

 

DelphiLint supports RAD Studio for Delphi 11+.

Feedback and contributions are welcome!

  • Like 16
  • Thanks 1

Share this post


Link to post

I have a stupid question about

Quote

Two analysis modes:

  • Standalone - run analyses entirely locally with a default set of active rules
  • Connected - connect to a SonarQube instance, (...)

 

Does that mean it runs entirely self-dependent, and I do not need a license for SonarQube?

Share this post


Link to post

I just tried it and it works. But I didn't see where I could remove the check for mixed names for example. And how to remove the texts from the file without closing Delphi

Share this post


Link to post
37 minutes ago, Der schöne Günther said:

I have a stupid question about

 

Does that mean it runs entirely self-dependent, and I do not need a license for SonarQube?

That's correct - you don't need to have anything SonarQube-related to use DelphiLint in standalone mode. After installing into the IDE, it's ready to go.

 

If you decide you would like to set up SonarQube and use DelphiLint in connected mode, it's worth mentioning that SonarQube Community Edition is free, open-source, self-hosted, and does not require any sort of license - with the SonarDelphi plugin it's a great (and free) option for managing Delphi code quality.

  • Like 1

Share this post


Link to post
4 minutes ago, tgbs said:

I just tried it and it works. But I didn't see where I could remove the check for mixed names for example. And how to remove the texts from the file without closing Delphi

Thanks for trying it out - glad it went smoothly for you!

 

Currently you cannot customise the list of rules used in standalone mode.

In connected mode, you can configure the rules to use on SonarQube - the relevant section of the SonarDelphi manual is here.

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.


There's also currently no way of "clearing" issues from a file after an analysis.

Of course, if you fix the issues and re-analyze the file, they will disappear, but if this is something you'd like to see as well then please let us know.

 

We're tracking feature requests and bugs using GitHub Issues - please raise an issue for any features you'd like to see (and of course, for any bugs you encounter)!
Contributions are also welcome :)

  • Like 1

Share this post


Link to post

Is it still not possible to create self-contained executables with Java? If so it would be nice because that would remove the requirement for the JRE.

  • Like 3

Share this post


Link to post

I installed it but I was not able to use it.

 

The first issue is that the BPL is not signed and our corporate policy would not allow Delphi to load the BPL. I worked around the issue by signing the BPL with our code signing certificate.

 

The next issue is that DelphiLint is unable to download SonarDelphi from GitHub. A better error message would be appreciated. The dialog simply says to check my internet connection, which is definitely working at the moment.

 

I am about to download SonarDelphi manually. Hopefully the documentation will have instructions on configuring DelphiLint so it "knows" that SonarDelphi is installed.

Share this post


Link to post
50 minutes ago, JonRobertson said:

I am about to download SonarDelphi manually

I am curious what the "standalone" version would download from GitHub. Following the link to install SonarDelphi, you need to install SonarQube, then SonarScanner, then install the SonarDelphi plug-in in SonarQube.

 

I installed SonarQube and configured a database via the install instructions. But the SonarQube service refuses to start.

Share this post


Link to post

Any way to turn off certain checks i.e.

 'Rename this field to match the expected naming conventions'

 

Anything to do with naming conventions should be optional IMO.

 

In general I would love to be able to switch certain checks off.

Share this post


Link to post

I've also seen a number of instances where it advised to "Remove this unused local variable" when the variable was in fact used.

Share this post


Link to post
38 minutes ago, Fudley said:

Any way to turn off certain checks i.e.

 'Rename this field to match the expected naming conventions'

 

Anything to do with naming conventions should be optional IMO.

 

In general I would love to be able to switch certain checks off.

Elliot answered a similar question earlier:

11 hours ago, Elliot Hillary said:

Currently you cannot customise the list of rules used in standalone mode.

In connected mode, you can configure the rules to use on SonarQube - the relevant section of the SonarDelphi manual is here.

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.

 

Share this post


Link to post
18 minutes ago, Fudley said:

I've also seen a number of instances where it advised to "Remove this unused local variable" when the variable was in fact used.

If you can provide a minimal reproducible example of this, we'd love to have an issue raised on SonarDelphi for it.

Share this post


Link to post
3 hours ago, JonRobertson said:

I am curious what the "standalone" version would download from GitHub. Following the link to install SonarDelphi, you need to install SonarQube, then SonarScanner, then install the SonarDelphi plug-in in SonarQube.

 

I installed SonarQube and configured a database via the install instructions. But the SonarQube service refuses to start.

It's just downloading the `sonar-delphi-plugin-<version>.jar` file from the SonarDelphi releases page.

To get around your issue with the automatic download you can manually download the latest released `.jar` from that page and place it inside `%APPDATA%\DelphiLint\plugins`.

Share this post


Link to post
11 hours ago, Stefan Glienke said:

Is it still not possible to create self-contained executables with Java? If so it would be nice because that would remove the requirement for the JRE.

While it is possible, it has a number of downsides. It's not an avenue we're pursuing at the moment since installing the JRE is pretty quick and easy.

Share this post


Link to post
Posted (edited)
4 hours ago, JonRobertson said:

I am curious what the "standalone" version would download from GitHub. Following the link to install SonarDelphi, you need to install SonarQube, then SonarScanner, then install the SonarDelphi plug-in in SonarQube. 

 

I installed SonarQube and configured a database via the install instructions. But the SonarQube service refuses to start.

As Zane says, DelphiLint just downloads the SonarDelphi plugin jar from a GitHub release (here) - internally, it runs the plugin as if it was running within SonarScanner.

Please note that if you choose to manually download the jar and place it in %APPDATA%\DelphiLint\plugins, it should be named "DEFAULT-sonar-delphi-plugin-1.3.0.jar".

Edited by Elliot Hillary

Share this post


Link to post
9 minutes ago, Elliot Hillary said:

if you choose to manually download the jar and place it in %APPDATA%\DelphiLint\plugins, it should be named "DEFAULT-sonar-delphi-plugin-1.3.0.jar"

Thanks for the extra info. Downloaded and renamed. The first unit that I tried to analyze gave this error:

DelphiLint encountered a problem during analysis.

An error was raised (java.lang.OutOfMemoryError: Java heap space ).

That unit has 464 lines of code. The entire project has 12,533 lines of code, not counting Delphi RTL, VCL, and third-party components. So this isn't a large project by any means.

 

This laptop has 32GB of physical memory and 13.5 GB was available at the time of the analysis.

Share this post


Link to post
57 minutes ago, JonRobertson said:

Thanks for the extra info. Downloaded and renamed. The first unit that I tried to analyze gave this error...

Sorry to hear that.

DelphiLint (and SonarDelphi) have been successfully used with much larger codebases than you describe - I suspect this could be a JVM issue.

Please raise an issue, including your JDK/JRE distribution and version, and we'll see what we can do!

Share this post


Link to post
1 hour ago, Elliot Hillary said:

Please raise an issue, including your JDK/JRE distribution and version, and we'll see what we can do

Done.  Issue 207

Share this post


Link to post
Posted (edited)

I cannot use this Tool: When i press "analyze" i get the error:

An error was raised:
(au.com.integradev.delphi.symbol.SymbolTableBuild... Path to Delphi standard library is invalid: C:\Program Files (x86)\Embarcadero\Studio\22.0\source).

The source is not on C:\Program Files (x86).., it is on c:\soft\Embarcadero\Studio\23.0\, so the ProgDir is wrong, also it "predicts" BDS22, i have BDS23.

 

Possible Solution:

You can read it from:
HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\23.0\RootDir

or you can add a new Option for the SourcePath in the menu to fix that

Edited by VoSs2o0o

Share this post


Link to post
1 hour ago, VoSs2o0o said:

I cannot use this Tool: When i press "analyze" i get the error

I suggest creating an Issue here. And there is no reason for an option to be added. The plug-in should determine the correct paths and Delphi version without needing you to configure it.

Share this post


Link to post
Posted (edited)

Thank you for your fast support, it is working now! Also this is a very impessive Tool. 

I will next try it with the SC-Server to have more control over the rules. It will be a Standardtool for me, when i make it to add/remove/tweak some rules...

Anyway it is still helpful in the Offline-Configuration.

Edited by VoSs2o0o
  • Like 1

Share this post


Link to post
8 hours ago, VoSs2o0o said:

Thank you for your fast support, it is working now! Also this is a very impessive Tool. 

I will next try it with the SC-Server to have more control over the rules. It will be a Standardtool for me, when i make it to add/remove/tweak some rules...

Anyway it is still helpful in the Offline-Configuration.

Great to see that your problem is resolved and you're finding DelphiLint helpful!

 

We're tracking features and bugs using the GitHub Issues for integrated-application-development/delphilint, so please let us know there if you encounter any problems in the future 🙂

Share this post


Link to post

How to uninstall

Share this post


Link to post
Posted (edited)
1 hour ago, tgbs said:

How to uninstall

To uninstall from your IDE, you remove it like any other package through Components > Install Packages. If you’d like to totally remove all traces of DelphiLint from your system, deleting the folder %APPDATA%\DelphiLint will do the trick. 

 

Although, if you’re uninstalling because you want to install a newer version of DelphiLint instead, there’s no need to do any of this - the install script automatically uninstalls any old versions.

Edited by Elliot Hillary
Inconsistent formatting
  • Like 2

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

×