sonarqube Submodule
Constructs
SonarqubeJavascriptProperties
A SonarQube configuration preset for JavaScript projects.
Provides sensible defaults for JavaScript analysis:
sonar.language=jssonar.sources=srcsonar.tests=testsonar.sourceEncoding=UTF-8sonar.profile=Sonar Waysonar.scm.provider=git- Typical exclusions for
node_modules,coverage, and test files sonar.javascript.lcov.reportPaths=coverage/lcov.info
All defaults can be overridden via options. Nested options (e.g. coverage,
javascript) are deep-merged with the defaults, so overriding one nested
field does not drop the other defaults in that subtree.
Example
new SonarqubeJavascriptProperties(project, {
projectKey: 'my-org_my-js-project',
});
Initializers
import { sonarqube } from 'projen'
new sonarqube.SonarqubeJavascriptProperties(scope: IConstruct, options: SonarqubeJavascriptPropertiesOptions)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsRequired
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { sonarqube } from 'projen'
sonarqube.SonarqubeJavascriptProperties.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { sonarqube } from 'projen'
sonarqube.SonarqubeJavascriptProperties.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.PropertiesFile | The underlying properties file. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
fileRequired
public readonly file: PropertiesFile;
- Type: projen.PropertiesFile
The underlying properties file.
SonarqubeProperties
Manages the sonar-project.properties configuration file for SonarQube analysis.
This component generates a sonar-project.properties file at the project
root with the specified configuration parameters. It provides typed options
whose structure mirrors the dot-notation property namespaces.
Example
new SonarqubeProperties(project, {
projectKey: 'my-org_my-project',
organization: 'my-org',
sources: 'src',
tests: 'test',
exclusions: ['*{@literal *}/node_modules/**'],
coverage: { exclusions: ['*{@literal *}/test/**'] },
javascript: { lcov: { reportPaths: ['coverage/lcov.info'] } },
sourceEncoding: 'UTF-8',
});
Initializers
import { sonarqube } from 'projen'
new sonarqube.SonarqubeProperties(scope: IConstruct, options: SonarqubePropertiesOptions)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsRequired
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { sonarqube } from 'projen'
sonarqube.SonarqubeProperties.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { sonarqube } from 'projen'
sonarqube.SonarqubeProperties.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.PropertiesFile | The underlying properties file. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
fileRequired
public readonly file: PropertiesFile;
- Type: projen.PropertiesFile
The underlying properties file.
SonarqubeRustProperties
A SonarQube configuration preset for Rust projects.
Provides sensible defaults for Rust analysis:
sonar.language=rustsonar.sources=srcsonar.tests=testssonar.sourceEncoding=UTF-8sonar.profile=Sonar Waysonar.scm.provider=git- Typical exclusions for
coverage, test, andtargetdirs sonar.rust.lcov.reportPaths=target/lcov.infosonar.rust.clippy.enabled=falsesonar.rust.clippyReport.reportPaths=target/clippy.json
All defaults can be overridden via options. Nested options (e.g. coverage,
rust) are deep-merged with the defaults, so overriding one nested field
does not drop the other defaults in that subtree.
Example
new SonarqubeRustProperties(project, {
projectKey: 'my-org_my-rust-project',
});
Initializers
import { sonarqube } from 'projen'
new sonarqube.SonarqubeRustProperties(scope: IConstruct, options: SonarqubeRustPropertiesOptions)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsRequired
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { sonarqube } from 'projen'
sonarqube.SonarqubeRustProperties.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { sonarqube } from 'projen'
sonarqube.SonarqubeRustProperties.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.PropertiesFile | The underlying properties file. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
fileRequired
public readonly file: PropertiesFile;
- Type: projen.PropertiesFile
The underlying properties file.
SonarqubeTypescriptProperties
A SonarQube configuration preset for TypeScript projects.
Provides sensible defaults for TypeScript analysis:
sonar.language=tssonar.sources=srcsonar.tests=testsonar.sourceEncoding=UTF-8sonar.profile=Sonar Waysonar.scm.provider=gitsonar.typescript.tsconfigPath=tsconfig.json- Typical exclusions for
node_modules,coverage, test files sonar.javascript.lcov.reportPaths=coverage/lcov.info
All defaults can be overridden via options. Nested options (e.g. coverage,
javascript) are deep-merged with the defaults, so overriding one nested
field does not drop the other defaults in that subtree.
Example
new SonarqubeTypescriptProperties(project, {
projectKey: 'my-org_my-ts-project',
});
Initializers
import { sonarqube } from 'projen'
new sonarqube.SonarqubeTypescriptProperties(scope: IConstruct, options: SonarqubeTypescriptPropertiesOptions)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsRequired
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Applies one or more mixins to this construct. |
| Called once, right after postSynthesize(), only when the project is created for the first time. |
| Called after synthesis. |
| Called before synthesis. |
| Called once, right after synthesize(), only when the project is created for the first time. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
with
public with(mixins: ...IMixin[]): IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
mixinsRequired
- Type: ...constructs.IMixin[]
The mixins to apply.
postProjectCreation
public postProjectCreation(initProject: InitProject): void
Called once, right after postSynthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
It is also skipped when post-synthesis steps are disabled, e.g. --no-post or PROJEN_DISABLE_POST.
Use it for one-off setup that can be turned off by the user, like running a task to give the user immediate
feedback on their new project. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
projectCreation
public projectCreation(initProject: InitProject): void
Called once, right after synthesize(), only when the project is created for the first time.
It does not run on later projen invocations. It only fires for projen new (or Projects.createProject).
Use it for deterministic, one-off file generation. Order across components is not guaranteed.
initProjectRequired
- Type: projen.InitProject
Details about how the project was created, e.g. its type and the original CLI args.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { sonarqube } from 'projen'
sonarqube.SonarqubeTypescriptProperties.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { sonarqube } from 'projen'
sonarqube.SonarqubeTypescriptProperties.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.PropertiesFile | The underlying properties file. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
fileRequired
public readonly file: PropertiesFile;
- Type: projen.PropertiesFile
The underlying properties file.
Structs
SonarqubeCoverageOptions
Options for sonar.coverage.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeCoverageOptions: sonarqube.SonarqubeCoverageOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Comma-separated file path patterns to exclude from test coverage calculations. |
exclusionsOptional
public readonly exclusions: string[];
- Type: string[]
- Default: no coverage exclusions
Comma-separated file path patterns to exclude from test coverage calculations.
Maps to sonar.coverage.exclusions.
SonarqubeCpdOptions
Options for sonar.cpd.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeCpdOptions: sonarqube.SonarqubeCpdOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Comma-separated file path patterns to exclude from code duplication detection. |
exclusionsOptional
public readonly exclusions: string[];
- Type: string[]
- Default: no duplication exclusions
Comma-separated file path patterns to exclude from code duplication detection.
Maps to sonar.cpd.exclusions.
SonarqubeFileOptions
File options for the generated sonar-project.properties file.
Initializer
import { sonarqube } from 'projen'
const sonarqubeFileOptions: sonarqube.SonarqubeFileOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | A comment to include at the top of the file. |
| boolean | Whether the generated file should be committed to git. |
| boolean | Adds the projen marker to the file. |
| boolean | Whether the generated file should be readonly. |
commentOptional
public readonly comment: string[];
- Type: string[]
- Default: no additional comment
A comment to include at the top of the file.
committedOptional
public readonly committed: boolean;
- Type: boolean
- Default: true
Whether the generated file should be committed to git.
markerOptional
public readonly marker: boolean;
- Type: boolean
- Default: marker will be included as long as the project is not ejected
Adds the projen marker to the file.
readonlyOptional
public readonly readonly: boolean;
- Type: boolean
- Default: true
Whether the generated file should be readonly.
SonarqubeJavascriptOptions
Options for sonar.javascript.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeJavascriptOptions: sonarqube.SonarqubeJavascriptOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | Options for sonar.javascript.lcov.*. |
lcovOptional
public readonly lcov: SonarqubeLcovOptions;
- Type: SonarqubeLcovOptions
- Default: no LCOV configuration
Options for sonar.javascript.lcov.*.
SonarqubeJavascriptPropertiesOptions
Options for SonarqubeJavascriptProperties.
Extends base options with JavaScript-specific defaults.
Initializer
import { sonarqube } from 'projen'
const sonarqubeJavascriptPropertiesOptions: sonarqube.SonarqubeJavascriptPropertiesOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The project's unique key. |
| | Coverage-related options (sonar.coverage.*). |
| | Duplication detection options (sonar.cpd.*). |
| string[] | Comma-separated file path patterns to exclude from the analysis scope. |
| {[ key: string ]: string} | Additional arbitrary properties to include in the configuration. |
| | Options for the generated properties file. |
| | JavaScript-specific options (sonar.javascript.*). |
| string | The language for analysis. |
| | Logging options (sonar.log.*). |
| string | The key of the organization to which the project belongs. |
| string | The quality profile name. |
| string | The project's base directory when the analysis needs to take place in a directory other than the one from which it was started. |
| string | Name of the project displayed on the web interface. |
| string | The project version. |
| | Quality gate options (sonar.qualitygate.*). |
| | The SonarQube Cloud instance's region. |
| | Rust-specific options (sonar.rust.*). |
| | SCM-related options (sonar.scm.*). |
| string | Encoding of the source files. |
| string | Comma-separated paths to directories containing main source code (non-test code). |
| string | Comma-separated paths to directories containing test code. |
| | TypeScript-specific options (sonar.typescript.*). |
projectKeyRequired
public readonly projectKey: string;
- Type: string
The project's unique key.
Can include up to 400 characters. Allowed characters: letters, digits, dash, underscore, periods, and colons.
Maps to sonar.projectKey. This parameter is mandatory.
coverageOptional
public readonly coverage: SonarqubeCoverageOptions;
- Type: SonarqubeCoverageOptions
- Default: no coverage configuration
Coverage-related options (sonar.coverage.*).
cpdOptional
public readonly cpd: SonarqubeCpdOptions;
- Type: SonarqubeCpdOptions
- Default: no CPD configuration
Duplication detection options (sonar.cpd.*).
exclusionsOptional
public readonly exclusions: string[];
- Type: string[]
- Default: no exclusions
Comma-separated file path patterns to exclude from the analysis scope.
Maps to sonar.exclusions.
extraPropertiesOptional
public readonly extraProperties: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: no additional properties
Additional arbitrary properties to include in the configuration.
Use this for properties not covered by the typed options.
Keys use dot-notation (e.g., sonar.java.binaries).
These are applied as overrides after the typed options above, so a key
that is a prefix of a typed option (e.g. "sonar.coverage") replaces
that entire subtree rather than merging with it.
fileOptionsOptional
public readonly fileOptions: SonarqubeFileOptions;
- Type: SonarqubeFileOptions
- Default: default file options
Options for the generated properties file.
javascriptOptional
public readonly javascript: SonarqubeJavascriptOptions;
- Type: SonarqubeJavascriptOptions
- Default: no JavaScript configuration
JavaScript-specific options (sonar.javascript.*).
languageOptional
public readonly language: string;
- Type: string
- Default: auto-detected
The language for analysis.
Maps to sonar.language.
logOptional
public readonly log: SonarqubeLogOptions;
- Type: SonarqubeLogOptions
- Default: INFO level
Logging options (sonar.log.*).
organizationOptional
public readonly organization: string;
- Type: string
- Default: no organization
The key of the organization to which the project belongs.
Maps to sonar.organization. Mandatory for SonarQube Cloud.
profileOptional
public readonly profile: string;
- Type: string
- Default: uses the default profile configured on the server
The quality profile name.
Maps to sonar.profile.
projectBaseDirOptional
public readonly projectBaseDir: string;
- Type: string
- Default: the directory from which the analysis was started
The project's base directory when the analysis needs to take place in a directory other than the one from which it was started.
Maps to sonar.projectBaseDir.
projectNameOptional
public readonly projectName: string;
- Type: string
- Default: not set
Name of the project displayed on the web interface.
Maps to sonar.projectName.
projectVersionOptional
public readonly projectVersion: string;
- Type: string
- Default: not set
The project version.
Maps to sonar.projectVersion.
qualitygateOptional
public readonly qualitygate: SonarqubeQualityGateOptions;
- Type: SonarqubeQualityGateOptions
- Default: quality gate not awaited
Quality gate options (sonar.qualitygate.*).
regionOptional
public readonly region: SonarqubeRegion;
- Type: SonarqubeRegion
- Default: SonarqubeRegion.EU
The SonarQube Cloud instance's region.
Maps to sonar.region.
rustOptional
public readonly rust: SonarqubeRustOptions;
- Type: SonarqubeRustOptions
- Default: no Rust configuration
Rust-specific options (sonar.rust.*).
scmOptional
public readonly scm: SonarqubeScmOptions;
- Type: SonarqubeScmOptions
- Default: no SCM configuration
SCM-related options (sonar.scm.*).
sourceEncodingOptional
public readonly sourceEncoding: string;
- Type: string
- Default: system encoding
Encoding of the source files.
Maps to sonar.sourceEncoding.
sourcesOptional
public readonly sources: string;
- Type: string
- Default: the project base directory
Comma-separated paths to directories containing main source code (non-test code).
Maps to sonar.sources.
testsOptional
public readonly tests: string;
- Type: string
- Default: no test code analyzed
Comma-separated paths to directories containing test code.
Maps to sonar.tests.
typescriptOptional
public readonly typescript: SonarqubeTypescriptOptions;
- Type: SonarqubeTypescriptOptions
- Default: no TypeScript configuration
TypeScript-specific options (sonar.typescript.*).
SonarqubeLcovOptions
Options for lcov report paths (shared between languages).
Initializer
import { sonarqube } from 'projen'
const sonarqubeLcovOptions: sonarqube.SonarqubeLcovOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Comma-separated paths to LCOV coverage report files. |
reportPathsOptional
public readonly reportPaths: string[];
- Type: string[]
- Default: not set
Comma-separated paths to LCOV coverage report files.
Maps to sonar.<language>.lcov.reportPaths.
SonarqubeLogOptions
Options for sonar.log.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeLogOptions: sonarqube.SonarqubeLogOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | Controls the quantity/level of logs produced during analysis. |
levelOptional
public readonly level: SonarqubeLogLevel;
- Type: SonarqubeLogLevel
- Default: SonarqubeLogLevel.INFO
Controls the quantity/level of logs produced during analysis.
Maps to sonar.log.level.
SonarqubePropertiesOptions
Options for SonarqubeProperties.
The interface structure mirrors the sonar.* dot-notation used in
sonar-project.properties. Nested interfaces map to nested property
namespaces. For example, scm.provider maps to sonar.scm.provider.
Initializer
import { sonarqube } from 'projen'
const sonarqubePropertiesOptions: sonarqube.SonarqubePropertiesOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The project's unique key. |
| | Coverage-related options (sonar.coverage.*). |
| | Duplication detection options (sonar.cpd.*). |
| string[] | Comma-separated file path patterns to exclude from the analysis scope. |
| {[ key: string ]: string} | Additional arbitrary properties to include in the configuration. |
| | Options for the generated properties file. |
| | JavaScript-specific options (sonar.javascript.*). |
| string | The language for analysis. |
| | Logging options (sonar.log.*). |
| string | The key of the organization to which the project belongs. |
| string | The quality profile name. |
| string | The project's base directory when the analysis needs to take place in a directory other than the one from which it was started. |
| string | Name of the project displayed on the web interface. |
| string | The project version. |
| | Quality gate options (sonar.qualitygate.*). |
| | The SonarQube Cloud instance's region. |
| | Rust-specific options (sonar.rust.*). |
| | SCM-related options (sonar.scm.*). |
| string | Encoding of the source files. |
| string | Comma-separated paths to directories containing main source code (non-test code). |
| string | Comma-separated paths to directories containing test code. |
| | TypeScript-specific options (sonar.typescript.*). |
projectKeyRequired
public readonly projectKey: string;
- Type: string
The project's unique key.
Can include up to 400 characters. Allowed characters: letters, digits, dash, underscore, periods, and colons.
Maps to sonar.projectKey. This parameter is mandatory.
coverageOptional
public readonly coverage: SonarqubeCoverageOptions;
- Type: SonarqubeCoverageOptions
- Default: no coverage configuration
Coverage-related options (sonar.coverage.*).
cpdOptional
public readonly cpd: SonarqubeCpdOptions;
- Type: SonarqubeCpdOptions
- Default: no CPD configuration
Duplication detection options (sonar.cpd.*).
exclusionsOptional
public readonly exclusions: string[];
- Type: string[]
- Default: no exclusions
Comma-separated file path patterns to exclude from the analysis scope.
Maps to sonar.exclusions.
extraPropertiesOptional
public readonly extraProperties: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: no additional properties
Additional arbitrary properties to include in the configuration.
Use this for properties not covered by the typed options.
Keys use dot-notation (e.g., sonar.java.binaries).
These are applied as overrides after the typed options above, so a key
that is a prefix of a typed option (e.g. "sonar.coverage") replaces
that entire subtree rather than merging with it.
fileOptionsOptional
public readonly fileOptions: SonarqubeFileOptions;
- Type: SonarqubeFileOptions
- Default: default file options
Options for the generated properties file.
javascriptOptional
public readonly javascript: SonarqubeJavascriptOptions;
- Type: SonarqubeJavascriptOptions
- Default: no JavaScript configuration
JavaScript-specific options (sonar.javascript.*).
languageOptional
public readonly language: string;
- Type: string
- Default: auto-detected
The language for analysis.
Maps to sonar.language.
logOptional
public readonly log: SonarqubeLogOptions;
- Type: SonarqubeLogOptions
- Default: INFO level
Logging options (sonar.log.*).
organizationOptional
public readonly organization: string;
- Type: string
- Default: no organization
The key of the organization to which the project belongs.
Maps to sonar.organization. Mandatory for SonarQube Cloud.
profileOptional
public readonly profile: string;
- Type: string
- Default: uses the default profile configured on the server
The quality profile name.
Maps to sonar.profile.
projectBaseDirOptional
public readonly projectBaseDir: string;
- Type: string
- Default: the directory from which the analysis was started
The project's base directory when the analysis needs to take place in a directory other than the one from which it was started.
Maps to sonar.projectBaseDir.
projectNameOptional
public readonly projectName: string;
- Type: string
- Default: not set
Name of the project displayed on the web interface.
Maps to sonar.projectName.
projectVersionOptional
public readonly projectVersion: string;
- Type: string
- Default: not set
The project version.
Maps to sonar.projectVersion.
qualitygateOptional
public readonly qualitygate: SonarqubeQualityGateOptions;
- Type: SonarqubeQualityGateOptions
- Default: quality gate not awaited
Quality gate options (sonar.qualitygate.*).
regionOptional
public readonly region: SonarqubeRegion;
- Type: SonarqubeRegion
- Default: SonarqubeRegion.EU
The SonarQube Cloud instance's region.
Maps to sonar.region.
rustOptional
public readonly rust: SonarqubeRustOptions;
- Type: SonarqubeRustOptions
- Default: no Rust configuration
Rust-specific options (sonar.rust.*).
scmOptional
public readonly scm: SonarqubeScmOptions;
- Type: SonarqubeScmOptions
- Default: no SCM configuration
SCM-related options (sonar.scm.*).
sourceEncodingOptional
public readonly sourceEncoding: string;
- Type: string
- Default: system encoding
Encoding of the source files.
Maps to sonar.sourceEncoding.
sourcesOptional
public readonly sources: string;
- Type: string
- Default: the project base directory
Comma-separated paths to directories containing main source code (non-test code).
Maps to sonar.sources.
testsOptional
public readonly tests: string;
- Type: string
- Default: no test code analyzed
Comma-separated paths to directories containing test code.
Maps to sonar.tests.
typescriptOptional
public readonly typescript: SonarqubeTypescriptOptions;
- Type: SonarqubeTypescriptOptions
- Default: no TypeScript configuration
TypeScript-specific options (sonar.typescript.*).
SonarqubeQualityGateOptions
Options for sonar.qualitygate.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeQualityGateOptions: sonarqube.SonarqubeQualityGateOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| number | The number of seconds that the scanner should wait for a report to be processed. |
| boolean | Forces the analysis step to poll the server and wait for the Quality Gate status. |
timeoutOptional
public readonly timeout: number;
- Type: number
- Default: 300
The number of seconds that the scanner should wait for a report to be processed.
Maps to sonar.qualitygate.timeout.
waitOptional
public readonly wait: boolean;
- Type: boolean
- Default: false
Forces the analysis step to poll the server and wait for the Quality Gate status.
Will fail the pipeline if the quality gate fails.
Maps to sonar.qualitygate.wait.
SonarqubeRustClippyOptions
Options for sonar.rust.clippy.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeRustClippyOptions: sonarqube.SonarqubeRustClippyOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Whether Clippy analysis is enabled. |
enabledOptional
public readonly enabled: boolean;
- Type: boolean
- Default: true
Whether Clippy analysis is enabled.
Maps to sonar.rust.clippy.enabled.
SonarqubeRustClippyReportOptions
Options for sonar.rust.clippyReport.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeRustClippyReportOptions: sonarqube.SonarqubeRustClippyReportOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | Paths to Clippy JSON report files. |
reportPathsOptional
public readonly reportPaths: string[];
- Type: string[]
- Default: not set
Paths to Clippy JSON report files.
Maps to sonar.rust.clippyReport.reportPaths.
SonarqubeRustOptions
Options for sonar.rust.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeRustOptions: sonarqube.SonarqubeRustOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | Options for sonar.rust.clippy.*. |
| | Options for sonar.rust.clippyReport.*. |
| | Options for sonar.rust.lcov.*. |
clippyOptional
public readonly clippy: SonarqubeRustClippyOptions;
- Type: SonarqubeRustClippyOptions
- Default: no clippy configuration
Options for sonar.rust.clippy.*.
clippyReportOptional
public readonly clippyReport: SonarqubeRustClippyReportOptions;
- Type: SonarqubeRustClippyReportOptions
- Default: no clippy report configuration
Options for sonar.rust.clippyReport.*.
lcovOptional
public readonly lcov: SonarqubeLcovOptions;
- Type: SonarqubeLcovOptions
- Default: no Rust LCOV configuration
Options for sonar.rust.lcov.*.
SonarqubeRustPropertiesOptions
Options for SonarqubeRustProperties.
Extends base options with Rust-specific defaults.
Initializer
import { sonarqube } from 'projen'
const sonarqubeRustPropertiesOptions: sonarqube.SonarqubeRustPropertiesOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The project's unique key. |
| | Coverage-related options (sonar.coverage.*). |
| | Duplication detection options (sonar.cpd.*). |
| string[] | Comma-separated file path patterns to exclude from the analysis scope. |
| {[ key: string ]: string} | Additional arbitrary properties to include in the configuration. |
| | Options for the generated properties file. |
| | JavaScript-specific options (sonar.javascript.*). |
| string | The language for analysis. |
| | Logging options (sonar.log.*). |
| string | The key of the organization to which the project belongs. |
| string | The quality profile name. |
| string | The project's base directory when the analysis needs to take place in a directory other than the one from which it was started. |
| string | Name of the project displayed on the web interface. |
| string | The project version. |
| | Quality gate options (sonar.qualitygate.*). |
| | The SonarQube Cloud instance's region. |
| | Rust-specific options (sonar.rust.*). |
| | SCM-related options (sonar.scm.*). |
| string | Encoding of the source files. |
| string | Comma-separated paths to directories containing main source code (non-test code). |
| string | Comma-separated paths to directories containing test code. |
| | TypeScript-specific options (sonar.typescript.*). |
projectKeyRequired
public readonly projectKey: string;
- Type: string
The project's unique key.
Can include up to 400 characters. Allowed characters: letters, digits, dash, underscore, periods, and colons.
Maps to sonar.projectKey. This parameter is mandatory.
coverageOptional
public readonly coverage: SonarqubeCoverageOptions;
- Type: SonarqubeCoverageOptions
- Default: no coverage configuration
Coverage-related options (sonar.coverage.*).
cpdOptional
public readonly cpd: SonarqubeCpdOptions;
- Type: SonarqubeCpdOptions
- Default: no CPD configuration
Duplication detection options (sonar.cpd.*).
exclusionsOptional
public readonly exclusions: string[];
- Type: string[]
- Default: no exclusions
Comma-separated file path patterns to exclude from the analysis scope.
Maps to sonar.exclusions.
extraPropertiesOptional
public readonly extraProperties: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: no additional properties
Additional arbitrary properties to include in the configuration.
Use this for properties not covered by the typed options.
Keys use dot-notation (e.g., sonar.java.binaries).
These are applied as overrides after the typed options above, so a key
that is a prefix of a typed option (e.g. "sonar.coverage") replaces
that entire subtree rather than merging with it.
fileOptionsOptional
public readonly fileOptions: SonarqubeFileOptions;
- Type: SonarqubeFileOptions
- Default: default file options
Options for the generated properties file.
javascriptOptional
public readonly javascript: SonarqubeJavascriptOptions;
- Type: SonarqubeJavascriptOptions
- Default: no JavaScript configuration
JavaScript-specific options (sonar.javascript.*).
languageOptional
public readonly language: string;
- Type: string
- Default: auto-detected
The language for analysis.
Maps to sonar.language.
logOptional
public readonly log: SonarqubeLogOptions;
- Type: SonarqubeLogOptions
- Default: INFO level
Logging options (sonar.log.*).
organizationOptional
public readonly organization: string;
- Type: string
- Default: no organization
The key of the organization to which the project belongs.
Maps to sonar.organization. Mandatory for SonarQube Cloud.
profileOptional
public readonly profile: string;
- Type: string
- Default: uses the default profile configured on the server
The quality profile name.
Maps to sonar.profile.
projectBaseDirOptional
public readonly projectBaseDir: string;
- Type: string
- Default: the directory from which the analysis was started
The project's base directory when the analysis needs to take place in a directory other than the one from which it was started.
Maps to sonar.projectBaseDir.
projectNameOptional
public readonly projectName: string;
- Type: string
- Default: not set
Name of the project displayed on the web interface.
Maps to sonar.projectName.
projectVersionOptional
public readonly projectVersion: string;
- Type: string
- Default: not set
The project version.
Maps to sonar.projectVersion.
qualitygateOptional
public readonly qualitygate: SonarqubeQualityGateOptions;
- Type: SonarqubeQualityGateOptions
- Default: quality gate not awaited
Quality gate options (sonar.qualitygate.*).
regionOptional
public readonly region: SonarqubeRegion;
- Type: SonarqubeRegion
- Default: SonarqubeRegion.EU
The SonarQube Cloud instance's region.
Maps to sonar.region.
rustOptional
public readonly rust: SonarqubeRustOptions;
- Type: SonarqubeRustOptions
- Default: no Rust configuration
Rust-specific options (sonar.rust.*).
scmOptional
public readonly scm: SonarqubeScmOptions;
- Type: SonarqubeScmOptions
- Default: no SCM configuration
SCM-related options (sonar.scm.*).
sourceEncodingOptional
public readonly sourceEncoding: string;
- Type: string
- Default: system encoding
Encoding of the source files.
Maps to sonar.sourceEncoding.
sourcesOptional
public readonly sources: string;
- Type: string
- Default: the project base directory
Comma-separated paths to directories containing main source code (non-test code).
Maps to sonar.sources.
testsOptional
public readonly tests: string;
- Type: string
- Default: no test code analyzed
Comma-separated paths to directories containing test code.
Maps to sonar.tests.
typescriptOptional
public readonly typescript: SonarqubeTypescriptOptions;
- Type: SonarqubeTypescriptOptions
- Default: no TypeScript configuration
TypeScript-specific options (sonar.typescript.*).
SonarqubeScmExclusionsOptions
Options for sonar.scm.exclusions.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeScmExclusionsOptions: sonarqube.SonarqubeScmExclusionsOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| boolean | Whether to disable files ignored by the SCM (e.g., files in .gitignore) from being excluded from analysis. |
disabledOptional
public readonly disabled: boolean;
- Type: boolean
- Default: false
Whether to disable files ignored by the SCM (e.g., files in .gitignore) from being excluded from analysis.
Maps to sonar.scm.exclusions.disabled.
SonarqubeScmOptions
Options for sonar.scm.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeScmOptions: sonarqube.SonarqubeScmOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | Options for sonar.scm.exclusions.*. |
| string | The SCM provider to use. |
exclusionsOptional
public readonly exclusions: SonarqubeScmExclusionsOptions;
- Type: SonarqubeScmExclusionsOptions
- Default: no exclusion overrides
Options for sonar.scm.exclusions.*.
providerOptional
public readonly provider: string;
- Type: string
- Default: auto-detected
The SCM provider to use.
Maps to sonar.scm.provider.
SonarqubeTypescriptOptions
Options for sonar.typescript.* properties.
Initializer
import { sonarqube } from 'projen'
const sonarqubeTypescriptOptions: sonarqube.SonarqubeTypescriptOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Path to the TypeScript configuration file. |
tsconfigPathOptional
public readonly tsconfigPath: string;
- Type: string
- Default: not set
Path to the TypeScript configuration file.
Maps to sonar.typescript.tsconfigPath.
SonarqubeTypescriptPropertiesOptions
Options for SonarqubeTypescriptProperties.
Extends base options with TypeScript-specific defaults.
Initializer
import { sonarqube } from 'projen'
const sonarqubeTypescriptPropertiesOptions: sonarqube.SonarqubeTypescriptPropertiesOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The project's unique key. |
| | Coverage-related options (sonar.coverage.*). |
| | Duplication detection options (sonar.cpd.*). |
| string[] | Comma-separated file path patterns to exclude from the analysis scope. |
| {[ key: string ]: string} | Additional arbitrary properties to include in the configuration. |
| | Options for the generated properties file. |
| | JavaScript-specific options (sonar.javascript.*). |
| string | The language for analysis. |
| | Logging options (sonar.log.*). |
| string | The key of the organization to which the project belongs. |
| string | The quality profile name. |
| string | The project's base directory when the analysis needs to take place in a directory other than the one from which it was started. |
| string | Name of the project displayed on the web interface. |
| string | The project version. |
| | Quality gate options (sonar.qualitygate.*). |
| | The SonarQube Cloud instance's region. |
| | Rust-specific options (sonar.rust.*). |
| | SCM-related options (sonar.scm.*). |
| string | Encoding of the source files. |
| string | Comma-separated paths to directories containing main source code (non-test code). |
| string | Comma-separated paths to directories containing test code. |
| | TypeScript-specific options (sonar.typescript.*). |
projectKeyRequired
public readonly projectKey: string;
- Type: string
The project's unique key.
Can include up to 400 characters. Allowed characters: letters, digits, dash, underscore, periods, and colons.
Maps to sonar.projectKey. This parameter is mandatory.
coverageOptional
public readonly coverage: SonarqubeCoverageOptions;
- Type: SonarqubeCoverageOptions
- Default: no coverage configuration
Coverage-related options (sonar.coverage.*).
cpdOptional
public readonly cpd: SonarqubeCpdOptions;
- Type: SonarqubeCpdOptions
- Default: no CPD configuration
Duplication detection options (sonar.cpd.*).
exclusionsOptional
public readonly exclusions: string[];
- Type: string[]
- Default: no exclusions
Comma-separated file path patterns to exclude from the analysis scope.
Maps to sonar.exclusions.
extraPropertiesOptional
public readonly extraProperties: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: no additional properties
Additional arbitrary properties to include in the configuration.
Use this for properties not covered by the typed options.
Keys use dot-notation (e.g., sonar.java.binaries).
These are applied as overrides after the typed options above, so a key
that is a prefix of a typed option (e.g. "sonar.coverage") replaces
that entire subtree rather than merging with it.
fileOptionsOptional
public readonly fileOptions: SonarqubeFileOptions;
- Type: SonarqubeFileOptions
- Default: default file options
Options for the generated properties file.
javascriptOptional
public readonly javascript: SonarqubeJavascriptOptions;
- Type: SonarqubeJavascriptOptions
- Default: no JavaScript configuration
JavaScript-specific options (sonar.javascript.*).
languageOptional
public readonly language: string;
- Type: string
- Default: auto-detected
The language for analysis.
Maps to sonar.language.
logOptional
public readonly log: SonarqubeLogOptions;
- Type: SonarqubeLogOptions
- Default: INFO level
Logging options (sonar.log.*).
organizationOptional
public readonly organization: string;
- Type: string
- Default: no organization
The key of the organization to which the project belongs.
Maps to sonar.organization. Mandatory for SonarQube Cloud.
profileOptional
public readonly profile: string;
- Type: string
- Default: uses the default profile configured on the server
The quality profile name.
Maps to sonar.profile.
projectBaseDirOptional
public readonly projectBaseDir: string;
- Type: string
- Default: the directory from which the analysis was started
The project's base directory when the analysis needs to take place in a directory other than the one from which it was started.
Maps to sonar.projectBaseDir.
projectNameOptional
public readonly projectName: string;
- Type: string
- Default: not set
Name of the project displayed on the web interface.
Maps to sonar.projectName.
projectVersionOptional
public readonly projectVersion: string;
- Type: string
- Default: not set
The project version.
Maps to sonar.projectVersion.
qualitygateOptional
public readonly qualitygate: SonarqubeQualityGateOptions;
- Type: SonarqubeQualityGateOptions
- Default: quality gate not awaited
Quality gate options (sonar.qualitygate.*).
regionOptional
public readonly region: SonarqubeRegion;
- Type: SonarqubeRegion
- Default: SonarqubeRegion.EU
The SonarQube Cloud instance's region.
Maps to sonar.region.
rustOptional
public readonly rust: SonarqubeRustOptions;
- Type: SonarqubeRustOptions
- Default: no Rust configuration
Rust-specific options (sonar.rust.*).
scmOptional
public readonly scm: SonarqubeScmOptions;
- Type: SonarqubeScmOptions
- Default: no SCM configuration
SCM-related options (sonar.scm.*).
sourceEncodingOptional
public readonly sourceEncoding: string;
- Type: string
- Default: system encoding
Encoding of the source files.
Maps to sonar.sourceEncoding.
sourcesOptional
public readonly sources: string;
- Type: string
- Default: the project base directory
Comma-separated paths to directories containing main source code (non-test code).
Maps to sonar.sources.
testsOptional
public readonly tests: string;
- Type: string
- Default: no test code analyzed
Comma-separated paths to directories containing test code.
Maps to sonar.tests.
typescriptOptional
public readonly typescript: SonarqubeTypescriptOptions;
- Type: SonarqubeTypescriptOptions
- Default: no TypeScript configuration
TypeScript-specific options (sonar.typescript.*).
Enums
SonarqubeLogLevel
Log level for SonarQube analysis.
Members
| Name | Description |
|---|---|
| Standard logging (default). |
| Verbose logging. |
| Most verbose, includes plugin/library output. |
INFO
Standard logging (default).
DEBUG
Verbose logging.
TRACE
Most verbose, includes plugin/library output.
SonarqubeRegion
SonarQube Cloud region.
Members
| Name | Description |
|---|---|
| EU instance (default). |
| US instance. |
EU
EU instance (default).
US
US instance.