mirror of
https://github.com/securego/gosec.git
synced 2025-03-13 09:54:45 +00:00
Simplify Analyzer.ignore by reducing nesting (#1269)
This commit is contained in:
parent
b62cc3316d
commit
b01f49e366
1 changed files with 60 additions and 55 deletions
|
@ -558,7 +558,13 @@ func (gosec *Analyzer) AppendError(file string, err error) {
|
|||
|
||||
// ignore a node (and sub-tree) if it is tagged with a nosec tag comment
|
||||
func (gosec *Analyzer) ignore(n ast.Node) map[string]issue.SuppressionInfo {
|
||||
if groups, ok := gosec.context.Comments[n]; ok && !gosec.ignoreNosec {
|
||||
if gosec.ignoreNosec {
|
||||
return nil
|
||||
}
|
||||
groups, ok := gosec.context.Comments[n]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Checks if an alternative for #nosec is set and, if not, uses the default.
|
||||
noSecDefaultTag, err := gosec.config.GetGlobal(Nosec)
|
||||
|
@ -619,7 +625,6 @@ func (gosec *Analyzer) ignore(n ast.Node) map[string]issue.SuppressionInfo {
|
|||
return ignores
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue