diff --git a/.golangci.yaml b/.golangci.yaml index 78d2d42..d274b7f 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -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 @@ -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 diff --git a/big.go b/big.go index efbc203..d813a8c 100644 --- a/big.go +++ b/big.go @@ -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 @@ -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 diff --git a/example_test.go b/example_test.go index e2a8b88..b7cc8cc 100644 --- a/example_test.go +++ b/example_test.go @@ -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)) diff --git a/helpers_test.go b/helpers_test.go index a37cdc9..6f942f9 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -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 @@ -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) { diff --git a/int.go b/int.go index 3be1eee..d0179ca 100644 --- a/int.go +++ b/int.go @@ -29,7 +29,6 @@ const ( sizeUint64 = 8 ) -//nolint:revive func (boolCodec) Append(buf []byte, value bool) []byte { if value { return append(buf, 1) @@ -37,7 +36,6 @@ func (boolCodec) Append(buf []byte, value bool) []byte { return append(buf, 0) } -//nolint:revive func (boolCodec) Put(buf []byte, value bool) []byte { if value { buf[0] = 1 diff --git a/prefix.go b/prefix.go index 1113975..3ec004b 100644 --- a/prefix.go +++ b/prefix.go @@ -79,7 +79,6 @@ type ( prefixNilsLast struct{} ) -//nolint:revive func (prefixNilsFirst) Append(buf []byte, isNil bool) (bool, []byte) { if isNil { return true, append(buf, prefixNilFirst) @@ -87,7 +86,6 @@ func (prefixNilsFirst) Append(buf []byte, isNil bool) (bool, []byte) { return false, append(buf, prefixNonNil) } -//nolint:revive func (prefixNilsFirst) Put(buf []byte, isNil bool) (bool, []byte) { if isNil { buf[0] = prefixNilFirst @@ -110,7 +108,6 @@ 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) @@ -118,7 +115,6 @@ func (prefixNilsLast) Append(buf []byte, isNil bool) (bool, []byte) { return false, append(buf, prefixNonNil) } -//nolint:revive func (prefixNilsLast) Put(buf []byte, isNil bool) (bool, []byte) { if isNil { buf[0] = prefixNilLast diff --git a/time_test.go b/time_test.go index 883d0b1..968b723 100644 --- a/time_test.go +++ b/time_test.go @@ -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 {