mirror of
https://github.com/securego/gosec.git
synced 2025-12-01 22:41:54 +02:00
address review comments
This commit is contained in:
@@ -52,6 +52,27 @@ var _ = Describe("Analyzer", func() {
|
||||
|
||||
})
|
||||
|
||||
It("should be able to analyze mulitple Go files", func() {
|
||||
analyzer.LoadRules(rules.Generate().Builders()...)
|
||||
pkg := testutils.NewTestPackage()
|
||||
defer pkg.Close()
|
||||
pkg.AddFile("foo.go", `
|
||||
package main
|
||||
func main(){
|
||||
bar()
|
||||
}`)
|
||||
pkg.AddFile("bar.go", `
|
||||
package main
|
||||
func bar(){
|
||||
println("package has two files!")
|
||||
}`)
|
||||
pkg.Build()
|
||||
err := analyzer.Process(pkg.Path)
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
_, metrics := analyzer.Report()
|
||||
Expect(metrics.NumFiles).To(Equal(2))
|
||||
})
|
||||
|
||||
It("should find errors when nosec is not in use", func() {
|
||||
|
||||
// Rule for MD5 weak crypto usage
|
||||
|
||||
Reference in New Issue
Block a user