-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
134 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Analyzing Delphi source code | ||
|
||
## Content | ||
|
||
* [Quickstart](#quickstart) | ||
* [Language-specific properties](#language-specific-properties) | ||
* [References](#references) | ||
|
||
## Quickstart | ||
|
||
Follow these steps to get started: | ||
|
||
1. **Prerequisites:** | ||
- [SonarQube](https://docs.sonarqube.org/latest/setup/install-server/) (v9.9+) | ||
- [SonarScanner](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner/) | ||
- [Delphi](https://www.embarcadero.com/products/delphi) | ||
|
||
2. **Install Plugin:** | ||
- Download the SonarDelphi plugin | ||
from [Releases](https://github.com/integrated-application-development/sonar-delphi/releases). | ||
- [Install the plugin](https://docs.sonarqube.org/latest/setup/install-plugin/). | ||
|
||
3. **Configure Analysis:** | ||
- Configure [language-specific properties](#language-specific-properties). | ||
|
||
4. **Run Analysis:** | ||
- Execute `sonar-scanner` in your project's root directory. | ||
|
||
5. **View Results:** | ||
- Visit the link provided at the end of the scan to view analysis results on SonarQube. | ||
|
||
> | ||
> :warning: **Note** | ||
> | ||
> The SonarDelphi analyzer requires source code for all dependencies, including the standard | ||
> library. | ||
> | ||
> As a result, Delphi CE is not supported. | ||
> | ||
## Language-specific properties | ||
|
||
You can discover and update the | ||
Delphi-specific [properties](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/analysis-parameters/) | ||
in: **Administration > General Settings > Languages > Delphi** | ||
|
||
By default, all `__history` and `__recovery` directories are excluded from the analysis. | ||
However, you can change the property `sonar.delphi.exclusions` to a different pattern if you want to | ||
force their analysis (not recommended). | ||
|
||
| Key | Value | Default Value | | ||
|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------| | ||
| `sonar.delphi.file.suffixes` | List of suffixes for Delphi files to analyze. To not filter, leave the list empty. | `.pas,.dpr,.dpk` | | ||
| `sonar.delphi.exclusions` | List of file path patterns to be excluded from analysis of Delphi files. | `**/__history/**,**/__recovery/**` | | ||
| `sonar.delphi.installationPath` | Path to the Delphi installation folder.<br/><br/>:warning: **Note**: This must point to a valid Delphi IDE installation, or the scan will fail. | `C:\Program Files (x86)\Embarcadero\Studio\22.0` | | ||
| `sonar.delphi.toolchain` | The compiler toolchain.<br/>Options: `DCC32`, `DCC64`, `DCCOSX`, `DCCOSX64`, `DCCIOSARM`, `DCCIOSARM64`, `DCCIOS32`, `DCCAARM`, `DCCAARM64`, `DCCLINUX64`<br/>See: [Delphi Toolchains](https://docwiki.embarcadero.com/RADStudio/en/Delphi_Toolchains) | `DCC32` | | ||
| `sonar.delphi.compilerVersion` | The Delphi conditional symbol representing the compiler version.<br/>Format: `VER<nnn>`.<br/>See: [Compiler Versions](http://docwiki.embarcadero.com/RADStudio/en/Compiler_Versions) | `VER350` | | ||
| `sonar.delphi.searchPath` | List of directories to search for include files and unit imports. Each path may be absolute or relative to the project base directory | - | | ||
| `sonar.delphi.conditionalDefines` | List of conditional defines to define while parsing the project, in addition to the defines aggregated from the project files | - | | ||
| `sonar.delphi.conditionalUndefines` | List of conditional defines to consider undefined while parsing the project. This is useful for flicking off some specific defines that were aggregated from the project files. | - | | ||
| `sonar.delphi.unitScopeNames` | List of unit scope names, used for import resolution. | - | | ||
| `sonar.delphi.unitAliases` | List of unit aliases, used for import resolution.<br/>Format: `AliasName=UnitName` | - | | ||
| `sonar.delphi.testType` | A fully qualified type name. Any code within this type or its descendants will be treated as test code | `TestFramework.TTestCase` | | ||
| `sonar.delphi.nunit.reportPaths` | List of directories containing the `*.xml` NUnit report files. Each path may be absolute or relative to the project base directory. | - | | ||
| `sonar.delphi.coverage.reportPaths` | List of directories containing the `*.xml` Delphi Code Coverage report files. Each path may be absolute or relative to the project base directory. | - | | ||
|
||
## References | ||
|
||
- [Analyzing source code](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/overview/) | ||
- [Analysis parameters](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/analysis-parameters/) |