Skip to content

Commit 3116b07

Browse files
alexandearCosmin Cojocar
authored andcommitted
Fix typos in comments and rulelist (#256)
1 parent e0a150b commit 3116b07

File tree

12 files changed

+18
-18
lines changed

12 files changed

+18
-18
lines changed

analyzer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333

3434
// The Context is populated with data parsed from the source code as it is scanned.
3535
// It is passed through to all rule functions as they are called. Rules may use
36-
// this data in conjunction withe the encoutered AST node.
36+
// this data in conjunction withe the encountered AST node.
3737
type Context struct {
3838
FileSet *token.FileSet
3939
Comments ast.CommentMap
@@ -66,7 +66,7 @@ type Analyzer struct {
6666
stats *Metrics
6767
}
6868

69-
// NewAnalyzer builds a new anaylzer.
69+
// NewAnalyzer builds a new analyzer.
7070
func NewAnalyzer(conf Config, logger *log.Logger) *Analyzer {
7171
ignoreNoSec := false
7272
if setting, err := conf.GetGlobal("nosec"); err == nil {

analyzer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var _ = Describe("Analyzer", func() {
5151

5252
})
5353

54-
It("should be able to analyze mulitple Go files", func() {
54+
It("should be able to analyze multiple Go files", func() {
5555
analyzer.LoadRules(rules.Generate().Builders())
5656
pkg := testutils.NewTestPackage()
5757
defer pkg.Close()
@@ -72,7 +72,7 @@ var _ = Describe("Analyzer", func() {
7272
Expect(metrics.NumFiles).To(Equal(2))
7373
})
7474

75-
It("should be able to analyze mulitple Go packages", func() {
75+
It("should be able to analyze multiple Go packages", func() {
7676
analyzer.LoadRules(rules.Generate().Builders())
7777
pkg1 := testutils.NewTestPackage()
7878
pkg2 := testutils.NewTestPackage()

cmd/gosec/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ func main() {
345345
logger.Fatal(err)
346346
}
347347

348-
// Finialize logging
348+
// Finalize logging
349349
logWriter.Close() // #nosec
350350

351351
// Do we have an issue? If so exit 1

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (c Config) GetGlobal(option string) (string, error) {
7878

7979
}
8080

81-
// SetGlobal associates a value with a global configuration ooption
81+
// SetGlobal associates a value with a global configuration option
8282
func (c Config) SetGlobal(option, value string) {
8383
if globals, ok := c[Globals]; ok {
8484
if settings, ok := globals.(map[string]string); ok {

helpers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func GetCallInfo(n ast.Node, ctx *Context) (string, string, error) {
166166
}
167167

168168
// GetImportedName returns the name used for the package within the
169-
// code. It will resolve aliases and ignores initalization only imports.
169+
// code. It will resolve aliases and ignores initialization only imports.
170170
func GetImportedName(path string, ctx *Context) (string, bool) {
171171
importName, imported := ctx.Imports.Imported[path]
172172
if !imported {
@@ -183,7 +183,7 @@ func GetImportedName(path string, ctx *Context) (string, bool) {
183183
return importName, true
184184
}
185185

186-
// GetImportPath resolves the full import path of an identifer based on
186+
// GetImportPath resolves the full import path of an identifier based on
187187
// the imports in the current context.
188188
func GetImportPath(name string, ctx *Context) (string, bool) {
189189
for path := range ctx.Imports.Imported {
@@ -257,7 +257,7 @@ func GetPkgAbsPath(pkgPath string) (string, error) {
257257
return absPath, nil
258258
}
259259

260-
// ConcatString recusively concatenates strings from a binary expression
260+
// ConcatString recursively concatenates strings from a binary expression
261261
func ConcatString(n *ast.BinaryExpr) (string, bool) {
262262
var s string
263263
// sub expressions are found in X object, Y object is always last BasicLit

issue.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const (
3434
High
3535
)
3636

37-
// Issue is returnd by a gosec rule if it discovers an issue with the scanned code.
37+
// Issue is returned by a gosec rule if it discovers an issue with the scanned code.
3838
type Issue struct {
3939
Severity Score `json:"severity"` // issue severity (how problematic it is)
4040
Confidence Score `json:"confidence"` // issue confidence (how sure we are we found it)
@@ -46,7 +46,7 @@ type Issue struct {
4646
}
4747

4848
// MetaData is embedded in all gosec rules. The Severity, Confidence and What message
49-
// will be passed tbhrough to reported issues.
49+
// will be passed through to reported issues.
5050
type MetaData struct {
5151
ID string
5252
Severity Score

output/formatter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"gopkg.in/yaml.v2"
2727
)
2828

29-
// ReportFormat enumrates the output format for reported issues
29+
// ReportFormat enumerates the output format for reported issues
3030
type ReportFormat int
3131

3232
const (

rule.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type Rule interface {
2727
type RuleBuilder func(id string, c Config) (Rule, []ast.Node)
2828

2929
// A RuleSet maps lists of rules to the type of AST node they should be run on.
30-
// The anaylzer will only invoke rules contained in the list associated with the
30+
// The analyzer will only invoke rules contained in the list associated with the
3131
// type of AST node it is currently visiting.
3232
type RuleSet map[reflect.Type][]Rule
3333

rules/readfile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (r *readfile) isJoinFunc(n ast.Node, c *gosec.Context) bool {
3838
for _, arg := range call.Args {
3939
// edge case: check if one of the args is a BinaryExpr
4040
if binExp, ok := arg.(*ast.BinaryExpr); ok {
41-
// iterate and resolve all found identites from the BinaryExpr
41+
// iterate and resolve all found identities from the BinaryExpr
4242
if _, ok := gosec.FindVarIdentities(binExp, c); ok {
4343
return true
4444
}
@@ -69,7 +69,7 @@ func (r *readfile) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, error) {
6969
}
7070
// handles binary string concatenation eg. ioutil.Readfile("/tmp/" + file + "/blob")
7171
if binExp, ok := arg.(*ast.BinaryExpr); ok {
72-
// resolve all found identites from the BinaryExpr
72+
// resolve all found identities from the BinaryExpr
7373
if _, ok := gosec.FindVarIdentities(binExp, c); ok {
7474
return gosec.NewIssue(c, n, r.ID(), r.What, r.Severity, r.Confidence), nil
7575
}

rules/rulelist.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func Generate(filters ...RuleFilter) RuleList {
7575

7676
// filesystem
7777
{"G301", "Poor file permissions used when creating a directory", NewMkdirPerms},
78-
{"G302", "Poor file permisions used when creation file or using chmod", NewFilePerms},
78+
{"G302", "Poor file permissions used when creation file or using chmod", NewFilePerms},
7979
{"G303", "Creating tempfile using a predictable path", NewBadTempFile},
8080
{"G304", "File path provided as taint input", NewReadFile},
8181
{"G305", "File path traversal when extracting zip archive", NewArchive},

0 commit comments

Comments
 (0)