in pkg/client/sonar/quality_profile.go [38:58]
func (sc *Client) GetQualityProfile(ctx context.Context, name string) (*QualityProfile, error) {
profiles := struct {
Profiles []QualityProfile `json:"profiles"`
}{}
resp, err := sc.startRequest(ctx).
SetQueryParam("qualityProfile", name).
SetResult(&profiles).
Get("/qualityprofiles/search")
if err = sc.checkError(resp, err); err != nil {
return nil, fmt.Errorf("failed to get quality profile: %w", err)
}
for _, profile := range profiles.Profiles {
if profile.Name == name {
return &profile, nil
}
}
return nil, NewHTTPError(http.StatusNotFound, fmt.Sprintf("quality profile %s not found", name))
}