Skip to content

Commit

Permalink
fix: typos in comments, tests, and func names
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Jul 24, 2024
1 parent 12b01ef commit 9b45265
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ help: dep-gawk
@ echo ""


# Helper Mehtods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Helper Methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dep-gawk:
@ if [ -z "$(shell command -v gawk)" ]; then \
if [ -x /usr/local/bin/brew ]; then $(MAKE) _brew_gawk_install; exit 0; fi; \
Expand All @@ -111,21 +111,21 @@ dep-gawk:
fi

_brew_gawk_install:
@ echo "Instaling gawk using brew... "
@ echo "Installing gawk using brew... "
@ brew install gawk --quiet
@ echo "done"

_ubuntu_gawk_install:
@ echo "Instaling gawk using apt-get... "
@ echo "Installing gawk using apt-get... "
@ apt-get -q install gawk -y
@ echo "done"

_alpine_gawk_install:
@ echo "Instaling gawk using yum... "
@ echo "Installing gawk using yum... "
@ apk add --update --no-cache gawk
@ echo "done"

_centos_gawk_install:
@ echo "Instaling gawk using yum... "
@ echo "Installing gawk using yum... "
@ yum install -q -y gawk;
@ echo "done"
2 changes: 1 addition & 1 deletion cmd/internal/mirror-table/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func formArgs(v checker.Violation, isAlt bool) string {
return strings.Join(a, ", ")
}

// form returens
// form returns
func formReturns(ret []string) string {
if len(ret) == 0 {
return ""
Expand Down
4 changes: 2 additions & 2 deletions cmd/internal/tests/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func QuoteRegexp(s string) string {
return str.String()
}

func GenReturnelements(n int) string {
func GenReturnElements(n int) string {
var ret []byte
for i := 0; i < n; i++ {
ret = append(ret, '_')
Expand Down Expand Up @@ -171,7 +171,7 @@ func generateTests(pkgName string, list []checker.Violation) []string {

templates.ExecuteTemplate(&buf, "case.tmpl", TestCase{
Arguments: []string{},
Returns: GenReturnelements(len(test.Generate.Returns)),
Returns: GenReturnElements(len(test.Generate.Returns)),
Package: pkgInTest,
PreCond: preCondition,
Func: makeFuncInline(test.Generate.Pattern,
Expand Down
6 changes: 3 additions & 3 deletions internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"strings"
)

// Checker will perform standart check on package and its methods.
// Checker will perform standard check on package and its methods.
type Checker struct {
Violations []Violation // List of available violations
Packages map[string][]int // Storing indexes of Violations per pkg/kg.Struct
Type func(ast.Expr) string // Type Checker closure.
Print func(ast.Node) []byte // String representation of the expresion.
Print func(ast.Node) []byte // String representation of the expression.
}

func New(violations ...[]Violation) Checker {
Expand Down Expand Up @@ -76,7 +76,7 @@ func (c *Checker) Handle(v *Violation, ce *ast.CallExpr) (map[int]ast.Expr, bool
continue
}

// is it convertsion call
// is it conversion call
if !c.callConverts(call) {
continue
}
Expand Down
6 changes: 3 additions & 3 deletions internal/checker/violation.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
UntypedRune string = "untyped rune"
)

// Violation describs what message we going to give to a particular code violation
// Violation describes what message we going to give to a particular code violation
type Violation struct {
Type ViolationType //
Args []int // Indexes of the arguments needs to be checked
Expand Down Expand Up @@ -143,7 +143,7 @@ func (v *Violation) Diagnostic(fSet *token.FileSet) analysis.Diagnostic {
v.AltPackage = v.Package
}

// Hooray! we dont need to change package and redo imports.
// Hooray! we don't need to change package and redo imports.
if v.Type == Function && v.AltPackage == v.Package && noNl {
diagnostic.SuggestedFixes = []analysis.SuggestedFix{{
Message: "Fix Issue With",
Expand All @@ -166,7 +166,7 @@ type GolangIssue struct {
Original string
}

// Issue intended to be used only within `golangci-lint`, bu you can use use it
// Issue intended to be used only within `golangci-lint`, but you can use it
// alongside Diagnostic if you wish.
func (v *Violation) Issue(fSet *token.FileSet) GolangIssue {
issue := GolangIssue{
Expand Down
10 changes: 5 additions & 5 deletions internal/checker/violation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,14 @@ func TestComplex(t *testing.T) {
check.Type = WrapType(&info)
check.Print = WrapPrint(fset)

var happend bool
var happened bool

ins.Preorder([]ast.Node{(*ast.CallExpr)(nil)}, func(n ast.Node) {
// allow to check only first call
if happend {
if happened {
return
}
happend = true
happened = true
// ---- test --------------------------------------------------
callExpr := n.(*ast.CallExpr)
expr := callExpr.Fun.(*ast.SelectorExpr)
Expand Down Expand Up @@ -243,8 +243,8 @@ func TestComplex(t *testing.T) {
}
})

if !happend {
t.Errorf("Test Not Happend")
if !happened {
t.Errorf("Test Not Happened")
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ util/cert/cert.go:82:10: avoid allocations with (*regexp.Regexp).MatchString (mi

- flag `--tests` (e.g. `--tests=false`)
- flag `--skip-files` (e.g. `--skip-files="_test.go"`)
- yaml confguration `run.skip-files`:
- yaml configuration `run.skip-files`:
```yaml
run:
skip-files:
- '(.+)_test\.go'
```
- yaml confguration `issues.exclude-rules`:
- yaml configuration `issues.exclude-rules`:
```yaml
issues:
exclude-rules:
Expand Down
2 changes: 1 addition & 1 deletion testdata/false_positive1.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ func S1() {
}

contentBuf := bytes.NewBufferString("foo-bar\n")
contentBuf.WriteString(hex.EncodeToString(h.Sum(nil))) // false postitve
contentBuf.WriteString(hex.EncodeToString(h.Sum(nil))) // false positive
}

0 comments on commit 9b45265

Please sign in to comment.