mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +00:00
Add some comments
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
d1467ac998
commit
4d4e5949c6
2 changed files with 2 additions and 0 deletions
1
issue.go
1
issue.go
|
@ -131,6 +131,7 @@ func (c Score) String() string {
|
|||
return "UNDEFINED"
|
||||
}
|
||||
|
||||
// codeSnippet extracts a code snippet based on the ast reference
|
||||
func codeSnippet(file *os.File, start int64, end int64, n ast.Node) (string, error) {
|
||||
if n == nil {
|
||||
return "", fmt.Errorf("invalid AST node provided")
|
||||
|
|
|
@ -322,6 +322,7 @@ func highlight(t string, s gosec.Score) string {
|
|||
}
|
||||
}
|
||||
|
||||
// printCodeSnippet prints the code snippet from the issue by adding a marker to the affected line
|
||||
func printCodeSnippet(issue *gosec.Issue) string {
|
||||
scanner := bufio.NewScanner(strings.NewReader(issue.Code))
|
||||
var buf bytes.Buffer
|
||||
|
|
Loading…
Reference in a new issue