Merge pull request #99 from mcpeak/fix-nosec

Fix nosec to work as documented
This commit is contained in:
Grant Murphy 2016-12-02 14:06:55 -08:00 committed by GitHub
commit 365e9f6cbc

View file

@ -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
} }