diff --git a/analyzer.go b/analyzer.go index ef8bae9..0f8870b 100644 --- a/analyzer.go +++ b/analyzer.go @@ -33,7 +33,7 @@ import ( // The Context is populated with data parsed from the source code as it is scanned. // It is passed through to all rule functions as they are called. Rules may use -// this data in conjunction withe the encoutered AST node. +// this data in conjunction withe the encountered AST node. type Context struct { FileSet *token.FileSet Comments ast.CommentMap @@ -66,7 +66,7 @@ type Analyzer struct { stats *Metrics } -// NewAnalyzer builds a new anaylzer. +// NewAnalyzer builds a new analyzer. func NewAnalyzer(conf Config, logger *log.Logger) *Analyzer { ignoreNoSec := false if setting, err := conf.GetGlobal("nosec"); err == nil { diff --git a/analyzer_test.go b/analyzer_test.go index 1942f44..0050310 100644 --- a/analyzer_test.go +++ b/analyzer_test.go @@ -51,7 +51,7 @@ var _ = Describe("Analyzer", func() { }) - It("should be able to analyze mulitple Go files", func() { + It("should be able to analyze multiple Go files", func() { analyzer.LoadRules(rules.Generate().Builders()) pkg := testutils.NewTestPackage() defer pkg.Close() @@ -72,7 +72,7 @@ var _ = Describe("Analyzer", func() { Expect(metrics.NumFiles).To(Equal(2)) }) - It("should be able to analyze mulitple Go packages", func() { + It("should be able to analyze multiple Go packages", func() { analyzer.LoadRules(rules.Generate().Builders()) pkg1 := testutils.NewTestPackage() pkg2 := testutils.NewTestPackage() diff --git a/cmd/gosec/main.go b/cmd/gosec/main.go index 3417a89..e68e2fd 100644 --- a/cmd/gosec/main.go +++ b/cmd/gosec/main.go @@ -345,7 +345,7 @@ func main() { logger.Fatal(err) } - // Finialize logging + // Finalize logging logWriter.Close() // #nosec // Do we have an issue? If so exit 1 diff --git a/config.go b/config.go index a19937f..ea07af3 100644 --- a/config.go +++ b/config.go @@ -78,7 +78,7 @@ func (c Config) GetGlobal(option string) (string, error) { } -// SetGlobal associates a value with a global configuration ooption +// SetGlobal associates a value with a global configuration option func (c Config) SetGlobal(option, value string) { if globals, ok := c[Globals]; ok { if settings, ok := globals.(map[string]string); ok { diff --git a/helpers.go b/helpers.go index 638129b..3127434 100644 --- a/helpers.go +++ b/helpers.go @@ -166,7 +166,7 @@ func GetCallInfo(n ast.Node, ctx *Context) (string, string, error) { } // GetImportedName returns the name used for the package within the -// code. It will resolve aliases and ignores initalization only imports. +// code. It will resolve aliases and ignores initialization only imports. func GetImportedName(path string, ctx *Context) (string, bool) { importName, imported := ctx.Imports.Imported[path] if !imported { @@ -183,7 +183,7 @@ func GetImportedName(path string, ctx *Context) (string, bool) { return importName, true } -// GetImportPath resolves the full import path of an identifer based on +// GetImportPath resolves the full import path of an identifier based on // the imports in the current context. func GetImportPath(name string, ctx *Context) (string, bool) { for path := range ctx.Imports.Imported { @@ -257,7 +257,7 @@ func GetPkgAbsPath(pkgPath string) (string, error) { return absPath, nil } -// ConcatString recusively concatenates strings from a binary expression +// ConcatString recursively concatenates strings from a binary expression func ConcatString(n *ast.BinaryExpr) (string, bool) { var s string // sub expressions are found in X object, Y object is always last BasicLit diff --git a/issue.go b/issue.go index 40bfa3d..6a2aa54 100644 --- a/issue.go +++ b/issue.go @@ -34,7 +34,7 @@ const ( High ) -// Issue is returnd by a gosec rule if it discovers an issue with the scanned code. +// Issue is returned by a gosec rule if it discovers an issue with the scanned code. type Issue struct { Severity Score `json:"severity"` // issue severity (how problematic it is) Confidence Score `json:"confidence"` // issue confidence (how sure we are we found it) @@ -46,7 +46,7 @@ type Issue struct { } // MetaData is embedded in all gosec rules. The Severity, Confidence and What message -// will be passed tbhrough to reported issues. +// will be passed through to reported issues. type MetaData struct { ID string Severity Score diff --git a/output/formatter.go b/output/formatter.go index ee98de4..eee693f 100644 --- a/output/formatter.go +++ b/output/formatter.go @@ -26,7 +26,7 @@ import ( "gopkg.in/yaml.v2" ) -// ReportFormat enumrates the output format for reported issues +// ReportFormat enumerates the output format for reported issues type ReportFormat int const ( diff --git a/rule.go b/rule.go index 415c708..fbba089 100644 --- a/rule.go +++ b/rule.go @@ -27,7 +27,7 @@ type Rule interface { type RuleBuilder func(id string, c Config) (Rule, []ast.Node) // A RuleSet maps lists of rules to the type of AST node they should be run on. -// The anaylzer will only invoke rules contained in the list associated with the +// The analyzer will only invoke rules contained in the list associated with the // type of AST node it is currently visiting. type RuleSet map[reflect.Type][]Rule diff --git a/rules/readfile.go b/rules/readfile.go index dbd18b0..87158f0 100644 --- a/rules/readfile.go +++ b/rules/readfile.go @@ -38,7 +38,7 @@ func (r *readfile) isJoinFunc(n ast.Node, c *gosec.Context) bool { for _, arg := range call.Args { // edge case: check if one of the args is a BinaryExpr if binExp, ok := arg.(*ast.BinaryExpr); ok { - // iterate and resolve all found identites from the BinaryExpr + // iterate and resolve all found identities from the BinaryExpr if _, ok := gosec.FindVarIdentities(binExp, c); ok { return true } @@ -69,7 +69,7 @@ func (r *readfile) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, error) { } // handles binary string concatenation eg. ioutil.Readfile("/tmp/" + file + "/blob") if binExp, ok := arg.(*ast.BinaryExpr); ok { - // resolve all found identites from the BinaryExpr + // resolve all found identities from the BinaryExpr if _, ok := gosec.FindVarIdentities(binExp, c); ok { return gosec.NewIssue(c, n, r.ID(), r.What, r.Severity, r.Confidence), nil } diff --git a/rules/rulelist.go b/rules/rulelist.go index 260cd3b..08d655b 100644 --- a/rules/rulelist.go +++ b/rules/rulelist.go @@ -75,7 +75,7 @@ func Generate(filters ...RuleFilter) RuleList { // filesystem {"G301", "Poor file permissions used when creating a directory", NewMkdirPerms}, - {"G302", "Poor file permisions used when creation file or using chmod", NewFilePerms}, + {"G302", "Poor file permissions used when creation file or using chmod", NewFilePerms}, {"G303", "Creating tempfile using a predictable path", NewBadTempFile}, {"G304", "File path provided as taint input", NewReadFile}, {"G305", "File path traversal when extracting zip archive", NewArchive}, diff --git a/rules/templates.go b/rules/templates.go index c452a28..0bff687 100644 --- a/rules/templates.go +++ b/rules/templates.go @@ -41,7 +41,7 @@ func (t *templateCheck) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, error } // NewTemplateCheck constructs the template check rule. This rule is used to -// find use of tempaltes where HTML/JS escaping is not being used +// find use of templates where HTML/JS escaping is not being used func NewTemplateCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) { calls := gosec.NewCallList() diff --git a/testutils/pkg.go b/testutils/pkg.go index ee85ac7..0f35ac2 100644 --- a/testutils/pkg.go +++ b/testutils/pkg.go @@ -29,7 +29,7 @@ type TestPackage struct { } // NewTestPackage will create a new and empty package. Must call Close() to cleanup -// auxilary files +// auxiliary files func NewTestPackage() *TestPackage { // Files must exist in $GOPATH sourceDir := path.Join(os.Getenv("GOPATH"), "src")