Skip to content

Commit

Permalink
Makefile: run gocritic with -enableAll over our sources (#987)
Browse files Browse the repository at this point in the history
Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
  • Loading branch information
quasilyte committed Sep 23, 2020
1 parent c4bd8d0 commit c2e13b8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -36,6 +36,8 @@ ci-linter:
@$(GOPATH_DIR)/bin/golangci-lint run -v
go install github.com/quasilyte/go-consistent
@$(GOPATH_DIR)/bin/go-consistent ./...
go build -o gocritic ./cmd/gocritic
./gocritic check -enableAll ./...

cover:
go install github.com/mattn/goveralls
Expand Down
2 changes: 1 addition & 1 deletion checkers/sortSlice_checker.go
Expand Up @@ -87,7 +87,7 @@ func (c *sortSliceChecker) VisitExpr(expr ast.Expr) {
}
}

func (c *sortSliceChecker) paramIdents(e *ast.FuncType) (*ast.Ident, *ast.Ident) {
func (c *sortSliceChecker) paramIdents(e *ast.FuncType) (ivar, jvar *ast.Ident) {
// Covers both `i, j int` and `i int, j int`.
idents := make([]*ast.Ident, 0, 2)
for _, field := range e.Params.List {
Expand Down
2 changes: 1 addition & 1 deletion checkers/whyNoLint_checker.go
Expand Up @@ -44,7 +44,7 @@ func (c whyNoLintChecker) VisitComment(cg *ast.CommentGroup) {
continue
}

if s := sl[1]; !strings.HasPrefix(s, "//") || len(strings.TrimPrefix(s, "//")) == 0 {
if s := sl[1]; !strings.HasPrefix(s, "//") || strings.TrimPrefix(s, "//") == "" {
c.ctx.Warn(cg, "include an explanation for nolint directive")
return
}
Expand Down
2 changes: 1 addition & 1 deletion rules.go
@@ -1,4 +1,4 @@
//nolint
//nolint // it's not a Go code file
package gorules

import (
Expand Down

0 comments on commit c2e13b8

Please sign in to comment.