Viewing docs for sonarqube 0.16.28
published on Friday, Oct 23, 2026 by jdamata
published on Friday, Oct 23, 2026 by jdamata
sonarqube
Viewing docs for sonarqube 0.16.28
published on Friday, Oct 23, 2026 by jdamata
published on Friday, Oct 23, 2026 by jdamata
Use this data source to list Sonarqube rules matching a set of filters, for example to activate them on a quality profile with for_each. All filters are optional and combine with AND; values within one filter combine with OR. SonarQube returns at most 10000 rules for one search, so use filters to narrow large rule sets.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as sonarqube from "@pulumi/sonarqube";
export = async () => {
const criticalCodeSmells = await sonarqube.getRules({
languages: ["java"],
types: ["CODE_SMELL"],
severities: ["CRITICAL"],
statuses: ["READY"],
});
const java = new sonarqube.Qualityprofile("java", {
name: "Java strict",
language: "java",
});
const criticalCodeSmellsQualityprofileActivateRule: sonarqube.QualityprofileActivateRule[] = [];
for (const range of Object.entries(.reduce((__obj, rule) => ({ ...__obj, [rule.key]: rule }))).map(([k, v]) => ({key: k, value: v}))) {
criticalCodeSmellsQualityprofileActivateRule.push(new sonarqube.QualityprofileActivateRule(`critical_code_smells-${range.key}`, {
key: java.key,
rule: range.key,
severity: range.value.severity,
}));
}
}
import pulumi
import pulumi_sonarqube as sonarqube
critical_code_smells = sonarqube.get_rules(languages=["java"],
types=["CODE_SMELL"],
severities=["CRITICAL"],
statuses=["READY"])
java = sonarqube.Qualityprofile("java",
name="Java strict",
language="java")
critical_code_smells_qualityprofile_activate_rule = []
for range in [{"key": k, "value": v} for [k, v] in enumerate({rule.key: rule for rule in critical_code_smells.rules})]:
critical_code_smells_qualityprofile_activate_rule.append(sonarqube.QualityprofileActivateRule(f"critical_code_smells-{range['key']}",
key=java.key,
rule=range["key"],
severity=%!v(PANIC=Format method: runtime error: index out of range [-1])))
Example coming soon!
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Pulumi;
using Sonarqube = Pulumi.Sonarqube;
return await Deployment.RunAsync(async() =>
{
var criticalCodeSmells = await Sonarqube.GetRules.InvokeAsync(new()
{
Languages = new[]
{
"java",
},
Types = new[]
{
"CODE_SMELL",
},
Severities = new[]
{
"CRITICAL",
},
Statuses = new[]
{
"READY",
},
});
var java = new Sonarqube.Qualityprofile("java", new()
{
Name = "Java strict",
Language = "java",
});
var criticalCodeSmellsQualityprofileActivateRule = new List<Sonarqube.QualityprofileActivateRule>();
foreach (var range in .Select(pair => new { pair.Key, pair.Value }))
{
criticalCodeSmellsQualityprofileActivateRule.Add(new Sonarqube.QualityprofileActivateRule($"critical_code_smells-{range.Key}", new()
{
Key = java.Key,
Rule = range.Key,
Severity = range.Value.Severity,
}));
}
});
Example coming soon!
resources:
java:
type: sonarqube:Qualityprofile
properties:
name: Java strict
language: java
criticalCodeSmellsQualityprofileActivateRule:
type: sonarqube:QualityprofileActivateRule
name: critical_code_smells
properties:
key: ${java.key}
rule: ${range.key}
severity: ${range.value.severity}
options: {}
variables:
criticalCodeSmells:
fn::invoke:
function: sonarqube:getRules
arguments:
languages:
- java
types:
- CODE_SMELL
severities:
- CRITICAL
statuses:
- READY
Example coming soon!
Using getRules
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRules(args: GetRulesArgs, opts?: InvokeOptions): Promise<GetRulesResult>
function getRulesOutput(args: GetRulesOutputArgs, opts?: InvokeOutputOptions): Output<GetRulesResult>def get_rules(id: Optional[str] = None,
languages: Optional[Sequence[str]] = None,
repositories: Optional[Sequence[str]] = None,
search: Optional[str] = None,
severities: Optional[Sequence[str]] = None,
statuses: Optional[Sequence[str]] = None,
tags: Optional[Sequence[str]] = None,
types: Optional[Sequence[str]] = None,
opts: Optional[InvokeOptions] = None) -> GetRulesResult
def get_rules_output(id: pulumi.Input[Optional[str]] = None,
languages: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
repositories: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
search: pulumi.Input[Optional[str]] = None,
severities: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
statuses: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
tags: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
types: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
opts: Optional[InvokeOutputOptions] = None) -> Output[GetRulesResult]func GetRules(ctx *Context, args *GetRulesArgs, opts ...InvokeOption) (*GetRulesResult, error)
func GetRulesOutput(ctx *Context, args *GetRulesOutputArgs, opts ...InvokeOption) GetRulesResultOutput> Note: This function is named GetRules in the Go SDK.
public static class GetRules
{
public static Task<GetRulesResult> InvokeAsync(GetRulesArgs args, InvokeOptions? opts = null)
public static Output<GetRulesResult> Invoke(GetRulesInvokeArgs args, InvokeOptions? opts = null)
public static Output<GetRulesResult> Invoke(GetRulesInvokeArgs args, InvokeOutputOptions opts)
}public static CompletableFuture<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
public static Output<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
public static Output<GetRulesResult> getRules(GetRulesArgs args, InvokeOutputOptions options)
fn::invoke:
function: sonarqube:index/getRules:getRules
arguments:
# arguments dictionarydata "sonarqube_get_rules" "name" {
# arguments
}The following arguments are supported:
- Id string
- The ID of this resource.
- Languages List<string>
- Language keys, e.g.
java,cs,js. - Repositories List<string>
- Rule repository keys, e.g.
java,csharpsquid. - Search string
- Free-text search, the same as the search box on the SonarQube rules page.
- Severities List<string>
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - Statuses List<string>
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - List<string>
- Rule tags.
- Types List<string>
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- Id string
- The ID of this resource.
- Languages []string
- Language keys, e.g.
java,cs,js. - Repositories []string
- Rule repository keys, e.g.
java,csharpsquid. - Search string
- Free-text search, the same as the search box on the SonarQube rules page.
- Severities []string
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - Statuses []string
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - []string
- Rule tags.
- Types []string
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id string
- The ID of this resource.
- languages list(string)
- Language keys, e.g.
java,cs,js. - repositories list(string)
- Rule repository keys, e.g.
java,csharpsquid. - search string
- Free-text search, the same as the search box on the SonarQube rules page.
- severities list(string)
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses list(string)
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - list(string)
- Rule tags.
- types list(string)
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id String
- The ID of this resource.
- languages List<String>
- Language keys, e.g.
java,cs,js. - repositories List<String>
- Rule repository keys, e.g.
java,csharpsquid. - search String
- Free-text search, the same as the search box on the SonarQube rules page.
- severities List<String>
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses List<String>
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - List<String>
- Rule tags.
- types List<String>
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id string
- The ID of this resource.
- languages string[]
- Language keys, e.g.
java,cs,js. - repositories string[]
- Rule repository keys, e.g.
java,csharpsquid. - search string
- Free-text search, the same as the search box on the SonarQube rules page.
- severities string[]
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses string[]
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - string[]
- Rule tags.
- types string[]
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id str
- The ID of this resource.
- languages Sequence[str]
- Language keys, e.g.
java,cs,js. - repositories Sequence[str]
- Rule repository keys, e.g.
java,csharpsquid. - search str
- Free-text search, the same as the search box on the SonarQube rules page.
- severities Sequence[str]
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses Sequence[str]
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - Sequence[str]
- Rule tags.
- types Sequence[str]
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id String
- The ID of this resource.
- languages List<String>
- Language keys, e.g.
java,cs,js. - repositories List<String>
- Rule repository keys, e.g.
java,csharpsquid. - search String
- Free-text search, the same as the search box on the SonarQube rules page.
- severities List<String>
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses List<String>
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - List<String>
- Rule tags.
- types List<String>
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
getRules Result
The following output properties are available:
- Id string
- The ID of this resource.
- Rules
List<Get
Rules Rule> - The rules matching the filters.
- Languages List<string>
- Language keys, e.g.
java,cs,js. - Repositories List<string>
- Rule repository keys, e.g.
java,csharpsquid. - Search string
- Free-text search, the same as the search box on the SonarQube rules page.
- Severities List<string>
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - Statuses List<string>
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - List<string>
- Rule tags.
- Types List<string>
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- Id string
- The ID of this resource.
- Rules
[]Get
Rules Rule - The rules matching the filters.
- Languages []string
- Language keys, e.g.
java,cs,js. - Repositories []string
- Rule repository keys, e.g.
java,csharpsquid. - Search string
- Free-text search, the same as the search box on the SonarQube rules page.
- Severities []string
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - Statuses []string
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - []string
- Rule tags.
- Types []string
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id string
- The ID of this resource.
- rules list(object)
- The rules matching the filters.
- languages list(string)
- Language keys, e.g.
java,cs,js. - repositories list(string)
- Rule repository keys, e.g.
java,csharpsquid. - search string
- Free-text search, the same as the search box on the SonarQube rules page.
- severities list(string)
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses list(string)
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - list(string)
- Rule tags.
- types list(string)
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id String
- The ID of this resource.
- rules
List<Get
Rules Rule> - The rules matching the filters.
- languages List<String>
- Language keys, e.g.
java,cs,js. - repositories List<String>
- Rule repository keys, e.g.
java,csharpsquid. - search String
- Free-text search, the same as the search box on the SonarQube rules page.
- severities List<String>
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses List<String>
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - List<String>
- Rule tags.
- types List<String>
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id string
- The ID of this resource.
- rules
Get
Rules Rule[] - The rules matching the filters.
- languages string[]
- Language keys, e.g.
java,cs,js. - repositories string[]
- Rule repository keys, e.g.
java,csharpsquid. - search string
- Free-text search, the same as the search box on the SonarQube rules page.
- severities string[]
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses string[]
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - string[]
- Rule tags.
- types string[]
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id str
- The ID of this resource.
- rules
Sequence[Get
Rules Rule] - The rules matching the filters.
- languages Sequence[str]
- Language keys, e.g.
java,cs,js. - repositories Sequence[str]
- Rule repository keys, e.g.
java,csharpsquid. - search str
- Free-text search, the same as the search box on the SonarQube rules page.
- severities Sequence[str]
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses Sequence[str]
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - Sequence[str]
- Rule tags.
- types Sequence[str]
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
- id String
- The ID of this resource.
- rules List<Property Map>
- The rules matching the filters.
- languages List<String>
- Language keys, e.g.
java,cs,js. - repositories List<String>
- Rule repository keys, e.g.
java,csharpsquid. - search String
- Free-text search, the same as the search box on the SonarQube rules page.
- severities List<String>
- Severities:
INFO,MINOR,MAJOR,CRITICAL,BLOCKER. - statuses List<String>
- Statuses:
READY,BETA,DEPRECATED,REMOVED. - List<String>
- Rule tags.
- types List<String>
- Types:
CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT.
Supporting Types
GetRulesRule
Package Details
- Repository
- sonarqube jdamata/terraform-provider-sonarqube
- License
- Notes
- This Pulumi package is based on the
sonarqubeTerraform Provider.
sonarqube
Viewing docs for sonarqube 0.16.28
published on Friday, Oct 23, 2026 by jdamata
published on Friday, Oct 23, 2026 by jdamata