mirror of
https://github.com/securego/gosec.git
synced 2025-04-17 11:56:39 +02:00
Add some comments
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
d1467ac998
commit
4d4e5949c6
1
issue.go
1
issue.go
@ -131,6 +131,7 @@ func (c Score) String() string {
|
|||||||
return "UNDEFINED"
|
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) {
|
func codeSnippet(file *os.File, start int64, end int64, n ast.Node) (string, error) {
|
||||||
if n == nil {
|
if n == nil {
|
||||||
return "", fmt.Errorf("invalid AST node provided")
|
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 {
|
func printCodeSnippet(issue *gosec.Issue) string {
|
||||||
scanner := bufio.NewScanner(strings.NewReader(issue.Code))
|
scanner := bufio.NewScanner(strings.NewReader(issue.Code))
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user