Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
Signed-off-by: Cosmin Cojocar <[email protected]>
  • Loading branch information
ccojocar authored and Cosmin Cojocar committed Jul 7, 2020
1 parent d1467ac commit 4d4e594
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions output/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4d4e594

Please sign in to comment.