mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 12:05:52 +00:00
Merge pull request #99 from mcpeak/fix-nosec
Fix nosec to work as documented
This commit is contained in:
commit
365e9f6cbc
1 changed files with 2 additions and 2 deletions
|
@ -183,11 +183,11 @@ func (gas *Analyzer) ProcessSource(filename string, source string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore a node (and sub-tree) if it is tagged with a "nosec" comment
|
// ignore a node (and sub-tree) if it is tagged with a "#nosec" comment
|
||||||
func (gas *Analyzer) ignore(n ast.Node) bool {
|
func (gas *Analyzer) ignore(n ast.Node) bool {
|
||||||
if groups, ok := gas.context.Comments[n]; ok && !gas.ignoreNosec {
|
if groups, ok := gas.context.Comments[n]; ok && !gas.ignoreNosec {
|
||||||
for _, group := range groups {
|
for _, group := range groups {
|
||||||
if strings.Contains(group.Text(), "nosec") {
|
if strings.Contains(group.Text(), "#nosec") {
|
||||||
gas.Stats.NumNosec++
|
gas.Stats.NumNosec++
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue