Skip to content

Commit

Permalink
fix: update linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Aug 15, 2023
1 parent 3a88465 commit 99a863c
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.3
version: v1.54.1
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ linters-settings:
locale: US
gci:
local-prefixes: github.com/evilmartians/lefthook
revive:
rules:
- name: unused-parameter
disabled: true

linters:
disable-all: true
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bench:

bin/golangci-lint:
@test -x $$(go env GOPATH)/bin/golangci-lint || \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.53.3
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.54.1

lint: bin/golangci-lint
$$(go env GOPATH)/bin/golangci-lint run
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/evilmartians/lefthook/internal/version"
)

func newVersionCmd(opts *lefthook.Options) *cobra.Command {
func newVersionCmd(_opts *lefthook.Options) *cobra.Command {
var verbose bool

versionCmd := cobra.Command{
Expand Down
6 changes: 1 addition & 5 deletions internal/lefthook/lefthook.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ func (l *Lefthook) cleanHook(hook string, force bool) error {

// Just remove lefthook hook
if l.isLefthookFile(hookPath) {
if err = l.Fs.Remove(hookPath); err != nil {
return err
}

return nil
return l.Fs.Remove(hookPath)
}

// Check if .old file already exists before renaming.
Expand Down
8 changes: 4 additions & 4 deletions internal/lefthook/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ import (

type GitMock struct{}

func (g GitMock) Cmd(cmd string) (string, error) {
func (g GitMock) Cmd(_cmd string) (string, error) {
return "", nil
}

func (g GitMock) CmdArgs(args ...string) (string, error) {
func (g GitMock) CmdArgs(_args ...string) (string, error) {
return "", nil
}

func (g GitMock) CmdLines(cmd string) ([]string, error) {
func (g GitMock) CmdLines(_cmd string) ([]string, error) {
return nil, nil
}

func (g GitMock) RawCmd(cmd string) (string, error) {
func (g GitMock) RawCmd(_cmd string) (string, error) {
return "", nil
}

Expand Down
1 change: 0 additions & 1 deletion internal/lefthook/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ func (r *Runner) runCommands() {
if len(r.RunOnlyCommands) == 0 || slices.Contains(r.RunOnlyCommands, name) {
commands = append(commands, name)
}

}

sort.Strings(commands)
Expand Down
4 changes: 2 additions & 2 deletions internal/lefthook/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

type TestExecutor struct{}

func (e TestExecutor) Execute(opts ExecuteOptions, out io.Writer) (err error) {
func (e TestExecutor) Execute(opts ExecuteOptions, _out io.Writer) (err error) {
if opts.args[0] == "success" {
err = nil
} else {
Expand All @@ -28,7 +28,7 @@ func (e TestExecutor) Execute(opts ExecuteOptions, out io.Writer) (err error) {
return
}

func (e TestExecutor) RawExecute(command []string, out io.Writer) error {
func (e TestExecutor) RawExecute(_command []string, _out io.Writer) error {
return nil
}

Expand Down
6 changes: 1 addition & 5 deletions internal/lefthook/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ func (l *Lefthook) Uninstall(args *UninstallArgs) error {
}
}

if err := l.Fs.RemoveAll(l.repo.RemotesFolder()); err != nil {
return err
}

return nil
return l.Fs.RemoveAll(l.repo.RemotesFolder())
}

func (l *Lefthook) deleteHooks(force bool) error {
Expand Down

0 comments on commit 99a863c

Please sign in to comment.