-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
res2 and body2 values2 should have better names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to use fmt.Sprintf. logger.Info has a format parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
type SonarqubePageInfo struct { | ||
Total int `json:"total"` | ||
P int `json:"p"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the meaning of p and ps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to use fmt.Errorf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this work? I think it should be "ps": []string{"1"}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes,
"ps": {"1"} is correct
"ps": {}string{"1"} is invalid syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* 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.