Skip to content

Commit 3bd7012

Browse files
Matovidloclaude
andcommitted
fix: resolve linter issues in notification and model code
- Replace filepath.Join with filesystem.Join in notification mapper - Add periods to end of type documentation comments - Use require.NoError for error assertions in tests - Add nolint:godox directives for legitimate TODO comments - Remove unused deleteNotification function - Fix gci formatting (struct field alignment, import ordering) - Remove unnecessary trailing newline in manager Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent a95d356 commit 3bd7012

7 files changed

Lines changed: 22 additions & 30 deletions

File tree

internal/pkg/mapper/notification/local_load.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package notification
22

33
import (
44
"context"
5-
"path/filepath"
65

76
"github.com/keboola/keboola-sdk-go/v2/pkg/keboola"
87

@@ -81,7 +80,7 @@ func (m *mapper) MapAfterLocalLoad(ctx context.Context, recipe *model.LocalLoadR
8180
NotificationKey: notification.NotificationKey,
8281
}
8382
notificationManifest.SetParentPath(configDir)
84-
notificationManifest.SetRelativePath(filepath.Join("notifications", entry.Name()))
83+
notificationManifest.SetRelativePath(filesystem.Join("notifications", entry.Name()))
8584

8685
notificationState := &model.NotificationState{
8786
NotificationManifest: notificationManifest,

internal/pkg/model/keys_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55

66
"github.com/stretchr/testify/assert"
7+
"github.com/stretchr/testify/require"
78
)
89

910
func TestNotificationKey_Kind(t *testing.T) {
@@ -122,7 +123,7 @@ func TestNotificationKey_ParentKey(t *testing.T) {
122123
ID: "456",
123124
}
124125
parent, err := key.ParentKey()
125-
assert.NoError(t, err)
126+
require.NoError(t, err)
126127
assert.Equal(t, expected, parent)
127128
}
128129

internal/pkg/model/manifest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ type ConfigManifest struct {
7777
RecordState `json:"-"`
7878
ConfigKey
7979
Paths
80-
Relations Relations `json:"relations,omitempty" validate:"dive"` // relations with other objects, for example variables definition
81-
Metadata *orderedmap.OrderedMap `json:"metadata,omitempty"`
80+
Relations Relations `json:"relations,omitempty" validate:"dive"` // relations with other objects, for example variables definition
81+
Metadata *orderedmap.OrderedMap `json:"metadata,omitempty"`
8282
Notifications []*NotificationManifest `json:"notifications,omitempty"`
8383
}
8484

internal/pkg/model/object.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ func (m BranchMetadata) ToOrderedMap() *orderedmap.OrderedMap {
365365
return res
366366
}
367367

368-
// Branch represents a development branch in Keboola Storage
368+
// Branch represents a development branch in Keboola Storage.
369369
type Branch struct {
370370
BranchKey
371371
Name string `json:"name" validate:"required" diff:"true" metaFile:"true"`
@@ -476,7 +476,7 @@ func (m ConfigMetadata) InstanceID() string {
476476
return m[instanceIDMetadataKey]
477477
}
478478

479-
// Config represents a component configuration in Keboola Storage
479+
// Config represents a component configuration in Keboola Storage.
480480
type Config struct {
481481
ConfigKey
482482
Name string `json:"name" validate:"required" diff:"true" metaFile:"true"`
@@ -531,7 +531,7 @@ func (c *ConfigWithRows) ToAPIObject(changeDescription string, changedFields Cha
531531
return out, append(changedFields.Slice(), "changeDescription")
532532
}
533533

534-
// ConfigRow represents a row within a component configuration
534+
// ConfigRow represents a row within a component configuration.
535535
type ConfigRow struct {
536536
ConfigRowKey
537537
Name string `json:"name" diff:"true" metaFile:"true"`

internal/pkg/state/remote/manager.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ func (u *UnitOfWork) LoadAll(filter model.ObjectsFilter) {
150150
return nil
151151
}),
152152
)
153-
154153
}
155154

156155
// Wait for sub-requests

internal/pkg/state/remote/notification.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,12 @@ func (u *UnitOfWork) createNotificationRequest(notification *model.Notification)
6666
req = req.WithFilters(notification.Filters)
6767
}
6868

69-
// TODO: Handle expiration - NotificationExpiration doesn't expose fields
69+
//nolint:godox // TODO: Handle expiration - NotificationExpiration doesn't expose fields
7070
// Need SDK update to support passing expiration directly
7171
_ = notification.ExpiresAt
7272

73-
// TODO: Add config reference once SDK supports it
73+
//nolint:godox // TODO: Add config reference once SDK supports it
7474
// req = req.WithConfig(notification.BranchID, notification.ComponentID, notification.ConfigID)
7575

7676
return req
7777
}
78-
79-
// deleteNotification deletes a notification subscription via API.
80-
func (u *UnitOfWork) deleteNotification(key model.NotificationKey) error {
81-
return u.keboolaProjectAPI.
82-
DeleteNotificationSubscriptionRequest(keboola.NotificationSubscriptionKey{ID: key.ID}).
83-
SendOrErr(u.ctx)
84-
}

internal/pkg/utils/testproject/project.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ import (
3232

3333
type Project struct {
3434
*testproject.Project
35-
initStartedAt time.Time
36-
ctx context.Context
37-
storageAPIToken *keboola.Token
38-
keboolaProjectAPI *keboola.AuthorizedAPI
39-
defaultBranch *keboola.Branch
40-
envs *env.Map
41-
mapsLock *sync.Mutex
42-
stateFilePath string
43-
branchesByID map[keboola.BranchID]*keboola.Branch
44-
branchesByName map[string]*keboola.Branch
45-
notificationIDs []keboola.NotificationSubscriptionID
46-
logFn func(format string, a ...any)
35+
initStartedAt time.Time
36+
ctx context.Context
37+
storageAPIToken *keboola.Token
38+
keboolaProjectAPI *keboola.AuthorizedAPI
39+
defaultBranch *keboola.Branch
40+
envs *env.Map
41+
mapsLock *sync.Mutex
42+
stateFilePath string
43+
branchesByID map[keboola.BranchID]*keboola.Branch
44+
branchesByName map[string]*keboola.Branch
45+
notificationIDs []keboola.NotificationSubscriptionID
46+
logFn func(format string, a ...any)
4747
}
4848

4949
type UnlockFn func()

0 commit comments

Comments
 (0)