Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{iframe:src=http://update.sonarsource.org/plugins/delphi.html|width=700|height=250|frameborder=0}
Your browser does not support iframes.
{iframe}

Description / Features

This plugin is donation of Sabre Airline Solutions

It enables analysis of projects written using Delphi or Pascal. It was tested with projects written in Delphi 6, 7, 2006 and XE.

It is using grammar in ANTLR v3 format. It is extended on grammar found at http://www.dragonkiller.nl/Delphi/delphi2009.txt

It is compatible with the Issues Report plugin to run pre-commit local analysis.

Include Page
Include - Plugin Installation
Include - Plugin Installation

Usage

Run an Analysis with the SonarQube Runner (Recommended Way)

To launch an analysis of your Delphi project, use the SonarQube Runner.

A sample project is available on github that can be browsed or downloaded/projects/languages/delphi/delphi-sonar-runner.

Run a SonarQubeAnalysis SonarQube Analysis with other Analyzers

Maven and Ant can also be used to launch analysis on Delphi projects.

...

  1. Grammar has problems with recognizing certain identifiers. When we add whitespace (“ “) at several places, everything works fine. It was difficult to solve this problem from the grammar level, so it is solved in DelphiSourceSanitizer class. It adds whitespaces where there are needed in parsed file, and grammar works fine. It is used for:
    1. Colon, “:” -> “ :”
    2. Array range, “x..y” -> “x .. y”
  2. Grammar is NOT case insensitive, but Delphi code is. Plugin deals with it by DelphiSourceSanitizer class, which feeds ANTLR parser lowercase characters (the “LA” method)
  3. Number of classes includes: classes, records
  4. Directory is count as a package. Number of packages equals number of directories.
  5. Preprocessor definitions between {$if xxx} and {$ifend} are removed (DefineResolver class).
  6. Sources imported to SonarQubeare SonarQube are parsed through IncludeResolver class. It means, that the source will be lowercased and unknown preprocessor definitions will be cut out.

...