Skip to content

Commit

Permalink
add linter
Browse files Browse the repository at this point in the history
  • Loading branch information
hariso committed Dec 11, 2023
1 parent eecf566 commit 5d064e8
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .golangci.goheader.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright © {{ copyright-year }} Meroxa, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
115 changes: 115 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
run:
timeout: 3m

linters-settings:
gofmt:
simplify: false
govet:
check-shadowing: false # TODO enable
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to mention the specific linter being suppressed
gocyclo:
min-complexity: 20
goconst:
ignore-tests: true
goheader:
template-path: '.golangci.goheader.template'
values:
regexp:
copyright-year: 20[2-9]\d

issues:
exclude-rules:
- path: '(.+)acceptance_testing\.go'
linters:
- stylecheck
text: "ST1003: should not use underscores in Go names"
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- dogsled
- gosec

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
# We plan to enable all of the linters which are commented out.
# However, we want to enable them one by one (so we don't have to fix many issues at once).
- bodyclose
# - depguard
- dogsled
- durationcheck
- errcheck
- errname
# - errorlint
# - exhaustive
# - exhaustivestruct
- exportloopref
# - forbidigo
# - forcetypeassert
# - funlen
# - gochecknoinits
- goconst
- gocritic
- gocyclo
# - cyclop # not interested in package complexities at the moment
# - godot
- gofmt
# - gofumpt
- goheader
- goimports
- revive
# - gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
# - ifshort
- ineffassign
# - importas
# - lll
# - misspell
- makezero
# - nakedret
# - nilerr
# - nilnil
# - nlreturn
- noctx
- nolintlint
# - paralleltest
- predeclared
- rowserrcheck
- staticcheck
- stylecheck
- sqlclosecheck
# - tagliatelle
# - tenv
# - thelper
# - tparallel
- typecheck
- unconvert
# - unparam
- unused
- wastedassign
- whitespace
# - wrapcheck
# - wsl

# don't enable:
# - asciicheck
# - dupl
# - gochecknoglobals
# - gocognit
# - godox
# - goerr113
# - maligned
# - nestif
# - prealloc
# - testpackage
# - wsl
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ install-tools:
.PHONY: generate
generate:
go generate ./...

test:
go test $(GOTEST_FLAGS) -race ./...
1 change: 1 addition & 0 deletions serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package serve

import (
"fmt"

"github.com/conduitio/conduit-processor-sdk"
"github.com/conduitio/conduit-processor-sdk/internal"

Check failure on line 21 in serve/serve.go

View workflow job for this annotation

GitHub Actions / golangci-lint

could not import github.com/conduitio/conduit-processor-sdk/internal (-: # github.com/conduitio/conduit-processor-sdk/internal
"github.com/goccy/go-json"
Expand Down

0 comments on commit 5d064e8

Please sign in to comment.