Skip to main content

sonarqube Submodule

Constructs

SonarqubeJavascriptProperties

A SonarQube configuration preset for JavaScript projects.

Provides sensible defaults for JavaScript analysis:

  • sonar.language = js
  • sonar.sources = src
  • sonar.tests = test
  • sonar.sourceEncoding = UTF-8
  • sonar.profile = Sonar Way
  • sonar.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)
NameTypeDescription
scope
constructs.IConstructNo description.
options
SonarqubeJavascriptPropertiesOptions
No description.

scopeRequired
  • Type: constructs.IConstruct

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
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

NameDescription
isConstruct
Checks if x is a construct.
isComponent
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

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
file
projen.PropertiesFileThe 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.

https://docs.sonarsource.com/sonarqube-cloud/analyzing-source-code/analysis-parameters/parameters-not-settable-in-ui

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)
NameTypeDescription
scope
constructs.IConstructNo description.
options
SonarqubePropertiesOptions
No description.

scopeRequired
  • Type: constructs.IConstruct

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
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

NameDescription
isConstruct
Checks if x is a construct.
isComponent
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

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
file
projen.PropertiesFileThe 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 = rust
  • sonar.sources = src
  • sonar.tests = tests
  • sonar.sourceEncoding = UTF-8
  • sonar.profile = Sonar Way
  • sonar.scm.provider = git
  • Typical exclusions for coverage, test, and target dirs
  • sonar.rust.lcov.reportPaths = target/lcov.info
  • sonar.rust.clippy.enabled = false
  • sonar.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)
NameTypeDescription
scope
constructs.IConstructNo description.
options
SonarqubeRustPropertiesOptions
No description.

scopeRequired
  • Type: constructs.IConstruct

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
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

NameDescription
isConstruct
Checks if x is a construct.
isComponent
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

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
file
projen.PropertiesFileThe 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 = ts
  • sonar.sources = src
  • sonar.tests = test
  • sonar.sourceEncoding = UTF-8
  • sonar.profile = Sonar Way
  • sonar.scm.provider = git
  • sonar.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)
NameTypeDescription
scope
constructs.IConstructNo description.
options
SonarqubeTypescriptPropertiesOptions
No description.

scopeRequired
  • Type: constructs.IConstruct

optionsRequired

Methods

NameDescription
toString
Returns a string representation of this construct.
with
Applies one or more mixins to this construct.
postProjectCreation
Called once, right after postSynthesize(), only when the project is created for the first time.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
projectCreation
Called once, right after synthesize(), only when the project is created for the first time.
synthesize
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

NameDescription
isConstruct
Checks if x is a construct.
isComponent
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

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
file
projen.PropertiesFileThe 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

NameTypeDescription
exclusions
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

NameTypeDescription
exclusions
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

NameTypeDescription
comment
string[]A comment to include at the top of the file.
committed
booleanWhether the generated file should be committed to git.
marker
booleanAdds the projen marker to the file.
readonly
booleanWhether 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

NameTypeDescription
lcov
SonarqubeLcovOptions
Options for sonar.javascript.lcov.*.

lcovOptional
public readonly lcov: SonarqubeLcovOptions;

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

NameTypeDescription
projectKey
stringThe project's unique key.
coverage
SonarqubeCoverageOptions
Coverage-related options (sonar.coverage.*).
cpd
SonarqubeCpdOptions
Duplication detection options (sonar.cpd.*).
exclusions
string[]Comma-separated file path patterns to exclude from the analysis scope.
extraProperties
{[ key: string ]: string}Additional arbitrary properties to include in the configuration.
fileOptions
SonarqubeFileOptions
Options for the generated properties file.
javascript
SonarqubeJavascriptOptions
JavaScript-specific options (sonar.javascript.*).
language
stringThe language for analysis.
log
SonarqubeLogOptions
Logging options (sonar.log.*).
organization
stringThe key of the organization to which the project belongs.
profile
stringThe quality profile name.
projectBaseDir
stringThe project's base directory when the analysis needs to take place in a directory other than the one from which it was started.
projectName
stringName of the project displayed on the web interface.
projectVersion
stringThe project version.
qualitygate
SonarqubeQualityGateOptions
Quality gate options (sonar.qualitygate.*).
region
SonarqubeRegion
The SonarQube Cloud instance's region.
rust
SonarqubeRustOptions
Rust-specific options (sonar.rust.*).
scm
SonarqubeScmOptions
SCM-related options (sonar.scm.*).
sourceEncoding
stringEncoding of the source files.
sources
stringComma-separated paths to directories containing main source code (non-test code).
tests
stringComma-separated paths to directories containing test code.
typescript
SonarqubeTypescriptOptions
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;

Coverage-related options (sonar.coverage.*).


cpdOptional
public readonly cpd: SonarqubeCpdOptions;

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;

Options for the generated properties file.


javascriptOptional
public readonly javascript: SonarqubeJavascriptOptions;

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;

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;

Quality gate options (sonar.qualitygate.*).


regionOptional
public readonly region: SonarqubeRegion;

The SonarQube Cloud instance's region.

Maps to sonar.region.


rustOptional
public readonly rust: SonarqubeRustOptions;

Rust-specific options (sonar.rust.*).


scmOptional
public readonly scm: SonarqubeScmOptions;

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;

TypeScript-specific options (sonar.typescript.*).


SonarqubeLcovOptions

Options for lcov report paths (shared between languages).

Initializer

import { sonarqube } from 'projen'

const sonarqubeLcovOptions: sonarqube.SonarqubeLcovOptions = { ... }

Properties

NameTypeDescription
reportPaths
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

NameTypeDescription
level
SonarqubeLogLevel
Controls the quantity/level of logs produced during analysis.

levelOptional
public readonly level: SonarqubeLogLevel;

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

NameTypeDescription
projectKey
stringThe project's unique key.
coverage
SonarqubeCoverageOptions
Coverage-related options (sonar.coverage.*).
cpd
SonarqubeCpdOptions
Duplication detection options (sonar.cpd.*).
exclusions
string[]Comma-separated file path patterns to exclude from the analysis scope.
extraProperties
{[ key: string ]: string}Additional arbitrary properties to include in the configuration.
fileOptions
SonarqubeFileOptions
Options for the generated properties file.
javascript
SonarqubeJavascriptOptions
JavaScript-specific options (sonar.javascript.*).
language
stringThe language for analysis.
log
SonarqubeLogOptions
Logging options (sonar.log.*).
organization
stringThe key of the organization to which the project belongs.
profile
stringThe quality profile name.
projectBaseDir
stringThe project's base directory when the analysis needs to take place in a directory other than the one from which it was started.
projectName
stringName of the project displayed on the web interface.
projectVersion
stringThe project version.
qualitygate
SonarqubeQualityGateOptions
Quality gate options (sonar.qualitygate.*).
region
SonarqubeRegion
The SonarQube Cloud instance's region.
rust
SonarqubeRustOptions
Rust-specific options (sonar.rust.*).
scm
SonarqubeScmOptions
SCM-related options (sonar.scm.*).
sourceEncoding
stringEncoding of the source files.
sources
stringComma-separated paths to directories containing main source code (non-test code).
tests
stringComma-separated paths to directories containing test code.
typescript
SonarqubeTypescriptOptions
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;

Coverage-related options (sonar.coverage.*).


cpdOptional
public readonly cpd: SonarqubeCpdOptions;

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;

Options for the generated properties file.


javascriptOptional
public readonly javascript: SonarqubeJavascriptOptions;

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;

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;

Quality gate options (sonar.qualitygate.*).


regionOptional
public readonly region: SonarqubeRegion;

The SonarQube Cloud instance's region.

Maps to sonar.region.


rustOptional
public readonly rust: SonarqubeRustOptions;

Rust-specific options (sonar.rust.*).


scmOptional
public readonly scm: SonarqubeScmOptions;

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;

TypeScript-specific options (sonar.typescript.*).


SonarqubeQualityGateOptions

Options for sonar.qualitygate.* properties.

Initializer

import { sonarqube } from 'projen'

const sonarqubeQualityGateOptions: sonarqube.SonarqubeQualityGateOptions = { ... }

Properties

NameTypeDescription
timeout
numberThe number of seconds that the scanner should wait for a report to be processed.
wait
booleanForces 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

NameTypeDescription
enabled
booleanWhether 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

NameTypeDescription
reportPaths
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

NameTypeDescription
clippy
SonarqubeRustClippyOptions
Options for sonar.rust.clippy.*.
clippyReport
SonarqubeRustClippyReportOptions
Options for sonar.rust.clippyReport.*.
lcov
SonarqubeLcovOptions
Options for sonar.rust.lcov.*.

clippyOptional
public readonly clippy: SonarqubeRustClippyOptions;

Options for sonar.rust.clippy.*.


clippyReportOptional
public readonly clippyReport: SonarqubeRustClippyReportOptions;

Options for sonar.rust.clippyReport.*.


lcovOptional
public readonly lcov: SonarqubeLcovOptions;

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

NameTypeDescription
projectKey
stringThe project's unique key.
coverage
SonarqubeCoverageOptions
Coverage-related options (sonar.coverage.*).
cpd
SonarqubeCpdOptions
Duplication detection options (sonar.cpd.*).
exclusions
string[]Comma-separated file path patterns to exclude from the analysis scope.
extraProperties
{[ key: string ]: string}Additional arbitrary properties to include in the configuration.
fileOptions
SonarqubeFileOptions
Options for the generated properties file.
javascript
SonarqubeJavascriptOptions
JavaScript-specific options (sonar.javascript.*).
language
stringThe language for analysis.
log
SonarqubeLogOptions
Logging options (sonar.log.*).
organization
stringThe key of the organization to which the project belongs.
profile
stringThe quality profile name.
projectBaseDir
stringThe project's base directory when the analysis needs to take place in a directory other than the one from which it was started.
projectName
stringName of the project displayed on the web interface.
projectVersion
stringThe project version.
qualitygate
SonarqubeQualityGateOptions
Quality gate options (sonar.qualitygate.*).
region
SonarqubeRegion
The SonarQube Cloud instance's region.
rust
SonarqubeRustOptions
Rust-specific options (sonar.rust.*).
scm
SonarqubeScmOptions
SCM-related options (sonar.scm.*).
sourceEncoding
stringEncoding of the source files.
sources
stringComma-separated paths to directories containing main source code (non-test code).
tests
stringComma-separated paths to directories containing test code.
typescript
SonarqubeTypescriptOptions
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;

Coverage-related options (sonar.coverage.*).


cpdOptional
public readonly cpd: SonarqubeCpdOptions;

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;

Options for the generated properties file.


javascriptOptional
public readonly javascript: SonarqubeJavascriptOptions;

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;

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;

Quality gate options (sonar.qualitygate.*).


regionOptional
public readonly region: SonarqubeRegion;

The SonarQube Cloud instance's region.

Maps to sonar.region.


rustOptional
public readonly rust: SonarqubeRustOptions;

Rust-specific options (sonar.rust.*).


scmOptional
public readonly scm: SonarqubeScmOptions;

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;

TypeScript-specific options (sonar.typescript.*).


SonarqubeScmExclusionsOptions

Options for sonar.scm.exclusions.* properties.

Initializer

import { sonarqube } from 'projen'

const sonarqubeScmExclusionsOptions: sonarqube.SonarqubeScmExclusionsOptions = { ... }

Properties

NameTypeDescription
disabled
booleanWhether 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

NameTypeDescription
exclusions
SonarqubeScmExclusionsOptions
Options for sonar.scm.exclusions.*.
provider
stringThe SCM provider to use.

exclusionsOptional
public readonly exclusions: SonarqubeScmExclusionsOptions;

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

NameTypeDescription
tsconfigPath
stringPath 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

NameTypeDescription
projectKey
stringThe project's unique key.
coverage
SonarqubeCoverageOptions
Coverage-related options (sonar.coverage.*).
cpd
SonarqubeCpdOptions
Duplication detection options (sonar.cpd.*).
exclusions
string[]Comma-separated file path patterns to exclude from the analysis scope.
extraProperties
{[ key: string ]: string}Additional arbitrary properties to include in the configuration.
fileOptions
SonarqubeFileOptions
Options for the generated properties file.
javascript
SonarqubeJavascriptOptions
JavaScript-specific options (sonar.javascript.*).
language
stringThe language for analysis.
log
SonarqubeLogOptions
Logging options (sonar.log.*).
organization
stringThe key of the organization to which the project belongs.
profile
stringThe quality profile name.
projectBaseDir
stringThe project's base directory when the analysis needs to take place in a directory other than the one from which it was started.
projectName
stringName of the project displayed on the web interface.
projectVersion
stringThe project version.
qualitygate
SonarqubeQualityGateOptions
Quality gate options (sonar.qualitygate.*).
region
SonarqubeRegion
The SonarQube Cloud instance's region.
rust
SonarqubeRustOptions
Rust-specific options (sonar.rust.*).
scm
SonarqubeScmOptions
SCM-related options (sonar.scm.*).
sourceEncoding
stringEncoding of the source files.
sources
stringComma-separated paths to directories containing main source code (non-test code).
tests
stringComma-separated paths to directories containing test code.
typescript
SonarqubeTypescriptOptions
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;

Coverage-related options (sonar.coverage.*).


cpdOptional
public readonly cpd: SonarqubeCpdOptions;

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;

Options for the generated properties file.


javascriptOptional
public readonly javascript: SonarqubeJavascriptOptions;

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;

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;

Quality gate options (sonar.qualitygate.*).


regionOptional
public readonly region: SonarqubeRegion;

The SonarQube Cloud instance's region.

Maps to sonar.region.


rustOptional
public readonly rust: SonarqubeRustOptions;

Rust-specific options (sonar.rust.*).


scmOptional
public readonly scm: SonarqubeScmOptions;

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;

TypeScript-specific options (sonar.typescript.*).


Enums

SonarqubeLogLevel

Log level for SonarQube analysis.

Members

NameDescription
INFO
Standard logging (default).
DEBUG
Verbose logging.
TRACE
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

NameDescription
EU
EU instance (default).
US
US instance.

EU

EU instance (default).


US

US instance.