1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-28 05:47:08 +02:00

sonarExecuteScan: fix building the URL to call sonar API (#4105)

* Fix IssueService

* Debug

* Debug

* Fix ComponentService

* Clean up

* Add comments
This commit is contained in:
Vyacheslav Starostin 2022-11-07 18:10:47 +06:00 committed by GitHub
parent 7f6fbe4bac
commit d256c3a604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -43,11 +43,11 @@ type SonarLanguageDistribution struct {
}
func (service *ComponentService) Component(options *MeasuresComponentOption) (*sonargo.MeasuresComponentObject, *http.Response, error) {
if len(service.Branch) > 0 {
options.Branch = service.Branch
}
// if PR, ignore branch name and consider PR branch name. If not PR, consider branch name
if len(service.PullRequest) > 0 {
options.PullRequest = service.PullRequest
} else if len(service.Branch) > 0 {
options.Branch = service.Branch
}
request, err := service.apiClient.create("GET", EndpointMeasuresComponent, options)
if err != nil {

View File

@ -51,14 +51,14 @@ func (service *IssueService) getIssueCount(severity issueSeverity) (int, error)
Resolved: "false",
Ps: "1",
}
if len(service.Branch) > 0 {
options.Branch = service.Branch
}
if len(service.Organization) > 0 {
options.Organization = service.Organization
}
// if PR, ignore branch name and consider PR branch name. If not PR, consider branch name
if len(service.PullRequest) > 0 {
options.PullRequest = service.PullRequest
} else if len(service.Branch) > 0 {
options.Branch = service.Branch
}
result, _, err := service.SearchIssues(options)
if err != nil {