Skip to content

Commit

Permalink
Remove deprecated linters and fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielius1922 committed May 28, 2024
1 parent 3d487bf commit 604c84b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ linters:
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted.
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- execinquery # Execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds.
- exportloopref # checks for pointers to enclosing loop variables
# - forcetypeassert # finds forced type assertions
- gci # Gci control golang package import order and make it always deterministic.
Expand Down Expand Up @@ -97,22 +96,19 @@ linters:
- cyclop # checks function and package cyclomatic complexity
- depguard # Go linter that checks if package imports are in a list of acceptable packages
- exhaustive # Check exhaustiveness of enum switch statements
- exhaustivestruct # Checks if all struct's fields are initialized
- exhaustruct # Checks if all structure fields are initialized.
- forbidigo # Forbids identifiers
- funlen # Tool for detection of long functions
- gochecknoglobals # Checks that no globals are present in Go code
- gochecknoinits # Checks that no init functions are present in Go code
- godot # Check if comments end in a period
- gomnd # An analyzer to detect magic numbers.
- ifshort # Checks that your code uses short syntax for if-statements whenever possible
- inamedparam # Reports interfaces with unnamed method parameters.
- interfacebloat # A linter that checks the number of methods inside an interface
- ireturn # Accept Interfaces, Return Concrete Types
- lll # Reports long lines
- maintidx # maintidx measures the maintainability index of each function.
- makezero # Finds slice declarations with non-zero initial length
- maligned # Tool to detect Go structs that would take less memory if their fields were sorted
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity
- nonamedreturns # Reports all named returns
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test
Expand Down
12 changes: 6 additions & 6 deletions cloud2cloud-gateway/service/subscribeToDevices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ func TestRequestHandlerSubscribeToDevices(t *testing.T) {
r.StrictSlash(true)
r.HandleFunc(eventsURI, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
h, err2 := events.ParseEventHeader(r)
assert.NoError(t, err2) //nolint:testifylint
assert.NoError(t, err2)
defer func() {
_ = r.Body.Close()
}()
assert.Equal(t, wantEventType, h.EventType)
buf, err2 := io.ReadAll(r.Body)
assert.NoError(t, err2) //nolint:testifylint
assert.NoError(t, err2)
var v interface{}
err2 = json.Decode(buf, &v)
assert.NoError(t, err2) //nolint:testifylint
assert.NoError(t, err2)
assert.Equal(t, wantEventContent, v)
w.WriteHeader(http.StatusOK)
err2 = eventsServer.Close()
Expand Down Expand Up @@ -171,16 +171,16 @@ func TestRequestHandlerSubscribeToDevicesOffline(t *testing.T) {
r.StrictSlash(true)
r.HandleFunc(eventsURI, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
h, err2 := events.ParseEventHeader(r)
assert.NoError(t, err2) //nolint:testifylint
assert.NoError(t, err2)
defer func() {
_ = r.Body.Close()
}()
assert.Equal(t, wantEventType, h.EventType)
buf, err2 := io.ReadAll(r.Body)
assert.NoError(t, err2) //nolint:testifylint
assert.NoError(t, err2)
var v interface{}
err2 = json.Decode(buf, &v)
assert.NoError(t, err2) //nolint:testifylint
assert.NoError(t, err2)
assert.Equal(t, wantEventContent, v)
w.WriteHeader(http.StatusOK)
err2 = eventsServer.Close()
Expand Down
6 changes: 3 additions & 3 deletions cloud2cloud-gateway/test/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ func (s *EventsServer) Run(t *testing.T) EventChan {
r.StrictSlash(true)
r.HandleFunc(s.uri, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
h, err := events.ParseEventHeader(r)
assert.NoError(t, err) //nolint:testifylint
assert.NoError(t, err)
defer func() {
_ = r.Body.Close()
}()
buf, err := io.ReadAll(r.Body)
assert.NoError(t, err) //nolint:testifylint
assert.NoError(t, err)

data, err := decodeEvent(h.EventType, buf)
assert.NoError(t, err) //nolint:testifylint
assert.NoError(t, err)
dataChan <- Event{
header: h,
data: data,
Expand Down
6 changes: 3 additions & 3 deletions test/iotivity-lite/service/offboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ func TestOffboard(t *testing.T) {
log.Debugf("%+v", h.CallCounter.Data)
signInCount, ok := h.CallCounter.Data[iotService.SignInKey]
require.True(t, ok)
require.Greater(t, signInCount, 0)
require.Positive(t, signInCount)
publishCount, ok := h.CallCounter.Data[iotService.PublishKey]
require.True(t, ok)
require.Equal(t, 1, publishCount)
singOffCount, ok := h.CallCounter.Data[iotService.SignOffKey]
require.True(t, ok)
require.Greater(t, singOffCount, 0)
require.Positive(t, singOffCount, 0)
}

coapShutdown := coapgwTest.SetUp(t, makeHandler, validateHandler)
Expand Down Expand Up @@ -337,7 +337,7 @@ func TestOffboardWithSignInByRefreshToken(t *testing.T) {
require.Greater(t, signInCount, 1)
refreshCount, ok := h.CallCounter.Data[iotService.RefreshTokenKey]
require.True(t, ok)
require.Greater(t, refreshCount, 0)
require.Positive(t, refreshCount, 0)
signOffCount, ok := h.CallCounter.Data[iotService.SignOffKey]
require.True(t, ok)
require.Equal(t, 1, signOffCount)
Expand Down
2 changes: 1 addition & 1 deletion test/iotivity-lite/service/republish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestRepublishAfterRefresh(t *testing.T) {
require.Greater(t, signInCount, 1)
refreshCount, ok := h.CallCounter.Data[iotService.RefreshTokenKey]
require.True(t, ok)
require.Greater(t, refreshCount, 0)
require.Positive(t, refreshCount, 0)
publishCount, ok := h.CallCounter.Data[iotService.PublishKey]
require.True(t, ok)
require.Equal(t, 1, publishCount)
Expand Down

0 comments on commit 604c84b

Please sign in to comment.