Back to directory
integrated-application-development avatar

delphilint

Delphi IDE package providing on-the-fly code analysis and linting, powered by SonarDelphi

143

Stars

30

Forks

17

Watchers

LGPL-3.0

License

DelphiLint

Build Format

DelphiLint is an IDE package for RAD Studio that provides on-the-fly code analysis and linting, powered by SonarDelphi.

Features

  • Brings SonarDelphi, a static analyzer for Delphi with 100+ code analysis rules, to the Delphi IDE
  • Analyze one or more files on-the-fly, shortening the feedback loop so you can pick up and fix problems before they're even checked in
  • Detected issues, along with descriptions and rationale, displayed inline in the IDE
  • Automated quick fixes for common issues, available via right click
  • Two analysis modes:
    • Standalone - run analyses entirely locally
      • No external servers or other tools required
      • Apply a default ruleset of commonly accepted Delphi rules, or pick and choose your desired coding style from the full list of SonarDelphi 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
  • Support for reading standard sonar-project.properties files, providing additional configuration
  • A Visual Studio Code companion extension that can be used to run analyses and show results in VS Code itself

Installation

System requirements:

Installation steps:

  1. Download the packaged zip for your Delphi version from the latest release, or build from source.
  2. Unzip the folder and run the included install.bat script.
  3. Done!

[!NOTE] Using the precompiled BPLs in different minor versions from which they were compiled can cause compatibility problems in some circumstances. If you encounter issues, please build from source.

Installing the VS Code companion

  1. Download the .vsix extension file from the latest release, or build from source.
  2. Run code --install-extension <vsix> to install the extension.

[!IMPORTANT] For the companion to work, a DelphiLint installation of the same version must be installed.

The VS Code companion is not required for the Delphi IDE plugin to function.

Usage

To analyze a file:

  1. Open a Delphi project in the IDE.
  2. Open the Delphi source file you want to analyze.
  3. Click the DelphiLint > Analyze This File menu option.

It's as easy as that! The DelphiLint window will then pop up, showing the current state of analysis and any issues that are raised. Please note that when the file has a lot of imports the analysis could take thirty seconds or so.

  • To analyze all files that are open in the IDE, use DelphiLint > Analyze All Open Files.
  • To clear a file of its analysis history, use DelphiLint > Clear Active File.
  • To apply quick fixes for an issue, right click the issue range in the editor window or the issue item in the DelphiLint window, then select the quick fix. (Note that not all issues may have quick fixes available.)

For more information:

  • See Configuration for details on project configuration settings.
  • See the FAQ for answers to common questions and problems.

Building from source

Prerequisites:

To build DelphiLint, use scripts/build.ps1:

  • scripts/build.ps1 280 to build for Delphi 11 Alexandria
  • scripts/build.ps1 290 to build for Delphi 12 Athens

This creates a target/DelphiLint-<version>- folder containing all built artifacts.

[!NOTE] build.ps1 looks for a Delphi installation in the default location for the given version. If your installation is elsewhere, supply the location as part of the version parameter, e.g. scripts/build.ps1 280=/my/custom/location.

Contributing

DelphiLint is open for contributions - please read the contributing guide for more information.

License

Licensed under the GNU Lesser General Public License, Version 3.0.

Releases

Jan 21, 2025

DelphiLint 1.3.0

Download .zip

Added

Support for the rule taxonomy mode selection in SonarQube 10.8. Support for INFO and BLOCKER severity impacts when using the multi-quality-rule mode.

Changed

Highlight.js has been updated to...

Oct 14, 2024

DelphiLint 1.2.0

Download .zip

Added

View Last Analysis Log option in the main DelphiLint window, which displays the analysis logs produced by SonarDelphi for the most recent analysis. Status indicator in the main DelphiLint windo...

Jun 10, 2024

DelphiLint 1.1.1

Download .zip

Changed

Error reporting has been improved around initialization of the rule view's Edge browser embed.

Fixed

Blank rule view when WebView2Loader.dll is not accessible from PATH. Blank rule view whe...

Jun 4, 2024

DelphiLint 1.1.0

Download .zip

Added

Clear Active File menu item, which clears all issues from the active file. VS Code companion: Clear Issues For This File command, which removes any outstanding issues on the current file. Suppo...

Apr 2, 2024

DelphiLint 1.0.2

Download .zip

Changed

Double clicking an issue in the issue view now centers the relevant line in the editor. The default SonarDelphi version is now 1.4.0.

Fixed

Idling before the DelphiLint server has been star...