Skip to content

Commit db1c296

Browse files
Merge pull request #103 from diegopereiraeng/main
sonar_token mandatory field lock
2 parents 60b06c0 + 58b459c commit db1c296

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This plugin is designed to run SonarQube scans, handle the results, and convert
66

77
- **New Parameter: `sonar_config_file`**
88
- **Type**: Boolean
9-
- **Description**: If set to true, the plugin will utilize the specified `sonar-project.properties` file for the SonarQube analysis, if it exists.
9+
- **Description**: If set to true, the plugin will utilize the specified `sonar-project.properties` file for the SonarQube analysis, if it exists. sonar_token param still mandatory.
1010
- **Environment Variable**: `PLUGIN_SONAR_CONFIG_FILE`
1111
- **Allowed Values**: `"true"`, `"false"`
1212

plugin.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,14 @@ func (p Plugin) Exec() error {
505505
args = append(args, "-Dsonar.host.url="+p.Config.Host)
506506
}
507507

508-
if len(p.Config.Token) >= 1 && p.Config.UseSonarConfigFileOverride {
508+
if len(p.Config.Token) >= 1 {
509509
fmt.Println("OVERRIDING sonar.login=" + p.Config.Token)
510510
args = append(args, "-Dsonar.login="+p.Config.Token)
511+
} else {
512+
fmt.Println("sonar_token param is also mandatory when using sonar-project.properties.")
513+
fmt.Println("Exiting with status 2")
514+
os.Exit(2)
515+
511516
}
512517

513518
if len(p.Config.Key) >= 1 && p.Config.UseSonarConfigFileOverride {

0 commit comments

Comments
 (0)