1
0
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:
Grant Murphy
2017-12-14 10:04:22 +10:00
parent af25ac1f6e
commit 25d74c6b20
4 changed files with 41 additions and 5 deletions

View File

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