Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruleguard: fix typos #467

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _docs/dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To add such documentation, use special pragmas when commenting a matcher functio
//doc:summary reports always false/true conditions
//doc:before strings.Count(s, "/") >= 0
//doc:after strings.Count(s, "/") > 0
//doc:tags diagnostic exprimental
//doc:tags diagnostic experimental
func badCond(m dsl.Matcher) {
m.Match(`strings.Count($_, $_) >= 0`).Report(`statement always true`)
m.Match(`bytes.Count($_, $_) >= 0`).Report(`statement always true`)
Expand Down
2 changes: 1 addition & 1 deletion _docs/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func gocriticBadCall(m dsl.Matcher) {
`bytes.Replace($_, $_, $_, 0)`,
`strings.SplitN($_, $_, 0)`,
`bytes.SplitN($_, $_, 0)`).
Report(`n=0 argument does nothing, maybe n=-1 is indended?`)
Report(`n=0 argument does nothing, maybe n=-1 is intended?`)

m.Match(`append($_)`).
Report(`append called with 1 argument does nothing`)
Expand Down
2 changes: 1 addition & 1 deletion analyzer/testdata/src/gocritic/f1.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func appendCombine2(xs []int, aa []int, bb []int) []int {
}

func badCall(s string, xs []int) {
_ = strings.Replace(s, "a", "b", 0) // want `\Qn=0 argument does nothing, maybe n=-1 is indended?`
_ = strings.Replace(s, "a", "b", 0) // want `\Qn=0 argument does nothing, maybe n=-1 is intended?`
_ = append(xs) // want `\Qappend called with 1 argument does nothing`
}

Expand Down
2 changes: 1 addition & 1 deletion analyzer/testdata/src/gocritic/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func testRules(m dsl.Matcher) {
Report(`$dst=append($x,$a,$b) is faster`)

m.Match(`strings.Replace($_, $_, $_, 0)`).
Report(`n=0 argument does nothing, maybe n=-1 is indended?`)
Report(`n=0 argument does nothing, maybe n=-1 is intended?`)

m.Match(`append($_)`).
Report(`append called with 1 argument does nothing`)
Expand Down
2 changes: 1 addition & 1 deletion dsl/dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type Var struct {
Const bool

// ConstSlice reports whether expr matched by var is a slice literal
// consisting of contant elements.
// consisting of constant elements.
//
// We need a separate Const-like predicate here because Go doesn't
// treat slices of const elements as constants, so including
Expand Down
2 changes: 1 addition & 1 deletion ruleguard/ir_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (l *irLoader) compileFilterFuncs(filename string, irfile *ir.File) error {
if err != nil {
// If this ever happens, user will get unexpected error
// lines for it; but we should trust that 99.9% errors
// should be catched at irconv phase so we get a valid Go
// should be caught at irconv phase so we get a valid Go
// source here as well?
return fmt.Errorf("parse custom decls: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion ruleguard/quasigo/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestEval(t *testing.T) {
{`foo.Method1(40)`, "Hello40"},
{`newFoo("x").Method1(11)`, "x11"},

// Accesing the fields.
// Accessing the fields.
{`foo.Prefix`, "Hello"},

// Nil checks.
Expand Down
2 changes: 1 addition & 1 deletion ruleguard/ruleguard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestTruncateText(t *testing.T) {
for _, test := range tests {
have := string(truncateText([]byte(test.input), test.maxLen))
if len(have) > test.maxLen {
t.Errorf("truncateText(%q, %v): len %d exceeeds max len",
t.Errorf("truncateText(%q, %v): len %d exceeds max len",
test.input, test.maxLen, len(have))
}
if len(test.input) > test.maxLen && len(have) != test.maxLen {
Expand Down
2 changes: 1 addition & 1 deletion ruleguard/textmatch/textmatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Pattern interface {
}

// Compile parses a regular expression and returns a compiled
// pattern that can match inputs descriped by the regexp.
// pattern that can match inputs described by the regexp.
//
// Semantically it's close to the regexp.Compile, but
// it does recognize some common patterns and creates
Expand Down
2 changes: 1 addition & 1 deletion ruleguard/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func isTypeExpr(info *types.Info, x ast.Expr) bool {

case *ast.Ident:
// Identifier may be a type expression if object
// it reffers to is a type name.
// it refers to is a type name.
_, ok := info.ObjectOf(x).(*types.TypeName)
return ok

Expand Down