fix: add collect sonarqube mode by file#6507
Conversation
| logger.Info("split by dir for it's count:[%d] and val:[%s]", value.Count, value.Val) | ||
| } else { | ||
| // by file | ||
| for _, issue := range body.Issues { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| if value2.Count > MAXISSUECOUNT { | ||
| logger.Warn(fmt.Errorf("the issue count [%d] exceeds the maximum page size", value2.Count), "") | ||
| } else { | ||
| iterator.Push(&SonarqubeIssueIteratorNode{ |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| logger.Info("split by dir, and it's issue count:[%d] and file path:[%s]", value.Count, value.Val) | ||
| } else { | ||
| // split it by dir when it's issue count > 10000 | ||
| res2, err := data.ApiClient.Get("issues/search", url.Values{ |
There was a problem hiding this comment.
res2 and body2 values2 should have better names.
| CreatedBefore: createdBefore, | ||
| FilePath: value2.Val, | ||
| }) | ||
| logger.Info(fmt.Sprintf("split by fil, and it's issue count:[%d] and file path:[%s]", value2.Count, value2.Val)) |
There was a problem hiding this comment.
no need to use fmt.Sprintf. logger.Info has a format parameter.
|
|
||
| type SonarqubePageInfo struct { | ||
| Total int `json:"total"` | ||
| P int `json:"p"` |
There was a problem hiding this comment.
what's the meaning of p and ps?
There was a problem hiding this comment.
p: 1-based page number
ps: Page size. Must be greater than 0 and less or equal than 500
| } | ||
| for _, value2 := range body2.Facets[0].Values { | ||
| if value2.Count > MAXISSUECOUNT { | ||
| logger.Warn(fmt.Errorf("the issue count [%d] exceeds the maximum page size", value2.Count), "") |
There was a problem hiding this comment.
func (log.Logger).Warn(err error, format string, a ...interface{})
The first parameter is of error type, so it is required
| "componentKeys": {fmt.Sprintf("%v", data.Options.ProjectKey)}, | ||
| "directories": {value.Val}, | ||
| "facets": {"files"}, | ||
| "ps": {"1"}, |
There was a problem hiding this comment.
Can this work? I think it should be "ps": []string{"1"}.
There was a problem hiding this comment.
yes,
"ps": {"1"} is correct
"ps": {}string{"1"} is invalid syntax
* fix: add collect sonarqube mode by file * fix: update some collector logic * fix: some params * fix: update some params * fix: still need to push issues when the count exceed MAXISSUECOUNT * fix: update log format and variable name --------- Co-authored-by: Lynwee <linwei.hou@merico.dev>
|
🤖 cherry pick finished successfully 🎉! |
* fix: add collect sonarqube mode by file * fix: update some collector logic * fix: some params * fix: update some params * fix: still need to push issues when the count exceed MAXISSUECOUNT * fix: update log format and variable name --------- Co-authored-by: abeizn <zikuan.an@merico.dev> Co-authored-by: Lynwee <linwei.hou@merico.dev>
* fix: add collect sonarqube mode by file * fix: update some collector logic * fix: some params * fix: update some params * fix: still need to push issues when the count exceed MAXISSUECOUNT * fix: update log format and variable name --------- Co-authored-by: Lynwee <linwei.hou@merico.dev>
|
🤖 cherry pick finished successfully 🎉! |
* fix: add collect sonarqube mode by file * fix: update some collector logic * fix: some params * fix: update some params * fix: still need to push issues when the count exceed MAXISSUECOUNT * fix: update log format and variable name --------- Co-authored-by: abeizn <zikuan.an@merico.dev> Co-authored-by: Lynwee <linwei.hou@merico.dev>
Summary
fix: add collect sonarqube mode by file
Does this close any open issues?
Closes #6493
Screenshots
Other Information
Any other information that is important to this PR.