-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Add sonarqube output #288
Merged
Merged
Add sonarqube output #288
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
931e758
Add sonarqube output
kmcrawford 2a7c5a7
Update Hound errors
kmcrawford 5024ad3
update README.md to add support of sonarqube.
kmcrawford a5b0d39
fix sonarIssues struct
kmcrawford 1b232d4
Extract to a constant
kmcrawford 7c1f8ad
remove panic
kmcrawford ba566ec
fix comment.
kmcrawford File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package output | ||
|
||
type textRange struct { | ||
StartLine int `json:"startLine"` | ||
EndLine int `json:"endLine"` | ||
StartColumn int `json:"startColumn,omitempty"` | ||
EtartColumn int `json:"endColumn,omitempty"` | ||
} | ||
type location struct { | ||
Message string `json:"message"` | ||
FilePath string `json:"filePath"` | ||
TextRange textRange `json:"textRange,omitempty"` | ||
} | ||
|
||
type sonarIssue struct { | ||
EngineID string `json:"engineId"` | ||
RuleID string `json:"ruleId"` | ||
PrimaryLocation location `json:"primaryLocation"` | ||
Type string `json:"type"` | ||
Severity string `json:"severity"` | ||
EffortMinutes int `json:"effortMinutes"` | ||
SecondaryLocations []location `json:"secondaryLocations,omitempty"` | ||
} | ||
|
||
type sonarIssues struct { | ||
SonarIssues []sonarIssue `json:"issues"` | ||
} | ||
|
||
func getSonarSeverity(s string) string { | ||
switch s { | ||
case "LOW": | ||
return "MINOR" | ||
case "MEDIUM": | ||
return "MAJOR" | ||
case "HIGH": | ||
return "BLOCKER" | ||
default: | ||
return "INFO" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not sure modifying the interface to achieve a truncated file path is the best solution here. Is there any specific reason for it? Sonarqube only recognize relative paths?
This is certainly something we can look at fixing though.
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, sonarqube reports from the root of the project. I needed a way to remove the full path. Happy to refactor, if you can think of a better way of doing this.
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.
Example of this working:
From: