Skip to content

joaocronemberger/sonar-delphi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SonarQube Delphi

Build Status

PayPal donate button

This is the SonarQube Delphi Plugin.

This plugin was originally a Sabre Airline Solutions donation.

Steps to Analyze a Delphi Project

  1. Install SonarQube Server (see Setup and Upgrade for more details). Check supported versions of the latest release of the plugin.
  2. Install one of the supported Runners (see below) and be sure you can call it from the directory where you have your source code
  3. Install Delphi Plugin (see Installing a Plugin for more details).
  4. Check the sample project corresponding to your Runner to know which config file you need to create. You can find the samples in sonar-delphi/samples.
  5. Run your Analyzer command from the project root dir
  6. Follow the link provided at the end of the analysis to browse your project's quality in SonarQube UI (see: Browsing SonarQube)

Supported Runners

To run an analysis of your Java project, you can use the following Runners:

  • SonarQube Runner: recommended for all non-Maven projects
  • Maven: recommended for all projects built with Maven
  • SonarQube Ant Task: to integrate with projects built with Ant
  • Gradle: to integrate with projects built with Gradle
  • Other options can be found here.

Reporting Issues

SonarQube Delphi Plugin uses GitHub's integrated issue tracking system to record bugs and feature requests. If you want to raise an issue, please follow the recommendations below:

  • Before you log a bug, please search the issue tracker to see if someone has already reported the problem.
  • If the issue doesn't already exist, create a new issue.
  • Please provide as much information as possible with the issue report, we like to know the version of SonarQube Delphi Plugin that you are using, as well as the SonarQube version.
  • If possible try to create a test-case or project that replicates the issue.

Implemented Features

  • Counting lines of code, statements, number of files
  • Counting number of classes, number of packages, methods, accessors
  • Counting number of public API (methods, classes and fields)
  • Counting comments ratio, comment lines (including blank lines)
  • CPD (code duplication, how many lines, block and in how many files)
  • Code Complexity (per method, class, file; complexity distribution over methods, classes and files)
  • LCOM4 and RFC
  • Code colorization
  • Unit tests reports
  • Assembler syntax in grammar
  • Include statement
  • Parsing preprocessor statements
  • Rules
  • Code coverage reports
  • Source code highlight for unit tests
  • "Dead" code recognition
  • Unused files recognition

Code Assumptions

  • 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)
  • Number of classes includes: classes, records
  • Directory is count as a package. Number of packages equals number of directories.
  • Preprocessor definitions between {$if xxx} and {$ifend} are removed (DefineResolver class).
  • Sources imported to SonarQube are parsed through IncludeResolver class. It means, that the source will be lowercased and unknown preprocessor definitions will be cut out.

DUnit Tests

You should put transformed DUnit xml files to directory specified using parameter sonar.junit.reportsPath. You can specify multiply directories separated by ,. Then all specified directories will be parsed. The path can be either absolute or relative to the project main path. The xml files should be renamed with TEST- prefix, example: dunit.xml -> TEST-dunit.xml. I recommend you to use dunit-extension to handle these details.

Importing into Eclipse

First run the eclipse maven goal:

mvn eclipse:eclipse

The project can then be imported into Eclipse using File -> Import and then selecting General -> Existing Projects into Workspace.

About

SonarQube Delphi Plugin

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 90.6%
  • GAP 4.9%
  • Pascal 4.5%