1
0
mirror of https://github.com/securego/gosec.git synced 2025-07-15 01:04:43 +02:00

Add a flag which allows to scan also the tests files

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar
2019-04-28 19:33:50 +02:00
committed by Cosmin Cojocar
parent f1d49a6945
commit b49c9532a8
4 changed files with 22 additions and 8 deletions

View File

@ -20,10 +20,11 @@ var _ = Describe("Analyzer", func() {
analyzer *gosec.Analyzer
logger *log.Logger
buildTags []string
tests bool
)
BeforeEach(func() {
logger, _ = testutils.NewLogger()
analyzer = gosec.NewAnalyzer(nil, logger)
analyzer = gosec.NewAnalyzer(nil, tests, logger)
})
Context("when processing a package", func() {
@ -226,7 +227,7 @@ var _ = Describe("Analyzer", func() {
// overwrite nosec option
nosecIgnoreConfig := gosec.NewConfig()
nosecIgnoreConfig.SetGlobal(gosec.Nosec, "true")
customAnalyzer := gosec.NewAnalyzer(nosecIgnoreConfig, logger)
customAnalyzer := gosec.NewAnalyzer(nosecIgnoreConfig, tests, logger)
customAnalyzer.LoadRules(rules.Generate(rules.NewRuleFilter(false, "G401")).Builders())
nosecPackage := testutils.NewTestPackage()