Skip to content
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
51 changes: 1 addition & 50 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ linters:
- nlreturn # also absurd, a blank line before every return and branch?
- promlinter # metrics collection not used
- protogetter # protocol buffers not used
- revive # mostly good, but flaky and doesn't allow nolint per sub-rule
- rowserrcheck # SQL not used
- spancheck # OpenTelemetry/Census not used
- thelper # I need the line numbers
Expand Down Expand Up @@ -289,56 +290,6 @@ linters:
patterns:
- .*

revive:

# Linting errors with less than this confidence will be ignored.
confidence: 0.6

# Enable all available rules.
enable-all-rules: true

# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md
rules:
- name: add-constant # duplicated by mnd
disabled: true
- name: bare-return # duplicated by nakedret
disabled: true
- name: cognitive-complexity # duplicated by gocognit
disabled: true
- name: cyclomatic # duplicated by cyclop
disabled: true
- name: function-length # duplicated by funlen
disabled: true
- name: line-length-limit # duplicated by formatters/golines
disabled: true
- name: comment-spacings # configuration of this rule does not work, and gofmt should fix it anyway.
disabled: true
- name: confusing-naming # can't handle multiple implementations of an interface
disabled: true
- name: confusing-results # uses here are not really problematic
disabled: true
- name: file-header # not using file headers
disabled: true
- name: max-public-structs # don't know how to limit to one file
disabled: true

- name: enforce-map-style
arguments:
- literal
- name: enforce-repeated-arg-type-style
arguments:
- short
- name: enforce-slice-style
arguments:
- literal
- name: max-control-nesting
arguments:
- 3
- name: unhandled-error
arguments:
- fmt.Printf
- fmt.Println

testifylint:
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
enable-all: true
Expand Down
2 changes: 0 additions & 2 deletions big.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ func (c bigFloatCodec) Append(buf []byte, value *big.Float) []byte {
isZero := prec == 0

var kind int8
//nolint:revive // switch is exhaustive
switch {
case isInf && signbit:
kind = negInf
Expand Down Expand Up @@ -288,7 +287,6 @@ func (c bigFloatCodec) Put(buf []byte, value *big.Float) []byte {
isZero := prec == 0

var kind int8
//nolint:revive // switch is exhaustive
switch {
case isInf && signbit:
kind = negInf
Expand Down
1 change: 0 additions & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ func ExampleDuration() {

func ExampleTime() {
codec := lexy.Time()
//nolint:revive // 678_901_234 is a fine syntax for nanoseconds
buf := codec.Append(nil, time.Date(2000, 1, 2, 3, 4, 5, 678_901_234, time.UTC))
decoded, _ := codec.Get(buf)
fmt.Println(decoded.Format(time.RFC3339Nano))
Expand Down
2 changes: 0 additions & 2 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ func (c testerCodec[T]) test(t *testing.T, tests []testCase[T]) {
}
}

//nolint:revive
func (c testerCodec[T]) getEmpty(t *testing.T) {
t.Run("get empty", func(t *testing.T) {
var zero T
Expand Down Expand Up @@ -253,7 +252,6 @@ func (c testerCodec[T]) get(t *testing.T, tt testCase[T], buf []byte) {
})
}

//nolint:revive
func (c testerCodec[T]) getShortBuf(t *testing.T, tt testCase[T], buf []byte) {
workingBuf := append([]byte{}, buf...)
t.Run("get short buf", func(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions int.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ const (
sizeUint64 = 8
)

//nolint:revive
func (boolCodec) Append(buf []byte, value bool) []byte {
if value {
return append(buf, 1)
}
return append(buf, 0)
}

//nolint:revive
func (boolCodec) Put(buf []byte, value bool) []byte {
if value {
buf[0] = 1
Expand Down
4 changes: 0 additions & 4 deletions prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ type (
prefixNilsLast struct{}
)

//nolint:revive
func (prefixNilsFirst) Append(buf []byte, isNil bool) (bool, []byte) {
if isNil {
return true, append(buf, prefixNilFirst)
}
return false, append(buf, prefixNonNil)
}

//nolint:revive
func (prefixNilsFirst) Put(buf []byte, isNil bool) (bool, []byte) {
if isNil {
buf[0] = prefixNilFirst
Expand All @@ -110,15 +108,13 @@ func (prefixNilsFirst) Get(buf []byte) (bool, []byte) {
}
}

//nolint:revive
func (prefixNilsLast) Append(buf []byte, isNil bool) (bool, []byte) {
if isNil {
return true, append(buf, prefixNilLast)
}
return false, append(buf, prefixNonNil)
}

//nolint:revive
func (prefixNilsLast) Put(buf []byte, isNil bool) (bool, []byte) {
if isNil {
buf[0] = prefixNilLast
Expand Down
4 changes: 0 additions & 4 deletions time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,11 @@ func timeTestCases() []testCase[time.Time] {
}
var zero time.Time
// Before the epoch start on Jan 1, 1970
//nolint:revive // 600_000_000 is a fine syntax for nanoseconds
past := time.Date(1900, 1, 2, 3, 4, 5, 600_000_000, time.UTC)
//nolint:gosmopolitan
local := time.Date(2000, 1, 2, 3, 4, 5, 6, time.Local)
//nolint:revive // 600_000_000 is a fine syntax for nanoseconds
utc := time.Date(2000, 1, 2, 3, 4, 5, 600_000_000, time.UTC)
//nolint:revive // 999_999_999 is a fine syntax for nanoseconds
nyc := time.Date(2000, 1, 2, 3, 4, 5, 999_999_999, locNYC)
//nolint:revive // 999_999_999 is a fine syntax for nanoseconds
berlin := time.Date(2000, 1, 2, 3, 4, 5, 999_999_999, locBerlin)
noZoneName, err := time.Parse(time.RFC3339Nano, "2000-01-02T03:04:05.6-05:00")
if err != nil {
Expand Down