Skip to content

Commit

Permalink
as: Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vlasebian committed Jan 8, 2025
1 parent e3a47c3 commit 846705a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 32 deletions.
7 changes: 3 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
run:
skip-dirs:
- node_modules

linters:

Check warning on line 1 in .golangci.yml

View workflow job for this annotation

GitHub Actions / Check Mergeability

.golangci.yml has a conflict when merging TheThingsIndustries/lorawan-stack:v3.33.
disable-all: true
enable:
Expand Down Expand Up @@ -113,3 +109,6 @@ issues:
- linters:
- paralleltest
text: 'does not use range value in test Run'
exclude-dirs:
- node_modules

65 changes: 38 additions & 27 deletions pkg/applicationserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ type InteropConfig struct {

// EndDeviceFetcherConfig represents configuration for the end device fetcher in Application Server.
type EndDeviceFetcherConfig struct {
Timeout time.Duration `name:"timeout" description:"Timeout of the end device retrival operation"`
Cache EndDeviceFetcherCacheConfig `name:"cache" description:"Cache configuration options for the end device fetcher"`
CircuitBreaker EndDeviceFetcherCircuitBreakerConfig `name:"circuit-breaker" description:"Circuit breaker options for the end device fetcher"`
Timeout time.Duration `name:"timeout" description:"Timeout of the end device retrival operation"` // nolint:lll
Cache EndDeviceFetcherCacheConfig `name:"cache" description:"Cache configuration options for the end device fetcher"` // nolint:lll
CircuitBreaker EndDeviceFetcherCircuitBreakerConfig `name:"circuit-breaker" description:"Circuit breaker options for the end device fetcher"` // nolint:lll
}

// EndDeviceFetcherCacheConfig represents configuration for device information caching in Application Server.
Expand All @@ -65,7 +65,7 @@ type EndDeviceFetcherCacheConfig struct {
type EndDeviceFetcherCircuitBreakerConfig struct {
Enable bool `name:"enable" description:"Enable circuit breaker behavior on burst errors"`
Timeout time.Duration `name:"timeout" description:"Timeout after which the circuit breaker closes"`
Threshold int `name:"threshold" description:"Number of failed fetching attempts after which the circuit breaker opens"`
Threshold int `name:"threshold" description:"Number of failed fetching attempts after which the circuit breaker opens"` // nolint:lll
}

// EndDeviceMetadataStorageConfig represents the configuration of end device metadata operations.
Expand All @@ -77,38 +77,38 @@ type EndDeviceMetadataStorageConfig struct {
// EndDeviceLocationStorageConfig represents the configuration of end device locations storage.
type EndDeviceLocationStorageConfig struct {
Registry metadata.EndDeviceLocationRegistry `name:"-"`
Timeout time.Duration `name:"timeout" description:"Timeout of the end device retrieval operation"`
Timeout time.Duration `name:"timeout" description:"Timeout of the end device retrieval operation"` // nolint:lll
Cache EndDeviceLocationStorageCacheConfig `name:"cache"`
}

// EndDeviceLocationStorageCacheConfig represents the configuration of end device location registry caching.
type EndDeviceLocationStorageCacheConfig struct {
Cache metadata.EndDeviceLocationCache `name:"-"`
Enable bool `name:"enable" description:"Enable caching of end device locations"`
MinRefreshInterval time.Duration `name:"min-refresh-interval" description:"Minimum time interval between two asynchronous refreshes"`
MaxRefreshInterval time.Duration `name:"max-refresh-interval" description:"Maximum time interval between two asynchronous refreshes"`
TTL time.Duration `name:"eviction-ttl" description:"Time to live of cached locations"`
Enable bool `name:"enable" description:"Enable caching of end device locations"` // nolint:lll
MinRefreshInterval time.Duration `name:"min-refresh-interval" description:"Minimum time interval between two asynchronous refreshes"` // nolint:lll
MaxRefreshInterval time.Duration `name:"max-refresh-interval" description:"Maximum time interval between two asynchronous refreshes"` // nolint:lll
TTL time.Duration `name:"eviction-ttl" description:"Time to live of cached locations"` // nolint:lll
}

// EndDeviceAttributesStorageConfig represents the configuration of end device attributes storage.
type EndDeviceAttributesStorageConfig struct {
Registry metadata.EndDeviceAttributesRegistry `name:"-"`
Timeout time.Duration `name:"timeout" description:"Timeout of the end device retrieval operation"`
Timeout time.Duration `name:"timeout" description:"Timeout of the end device retrieval operation"` // nolint:lll
Cache EndDeviceAttributesStorageCacheConfig `name:"cache"`
}

// EndDeviceAttributesStorageCacheConfig represents the configuration of end device attributes registry caching.
type EndDeviceAttributesStorageCacheConfig struct {
Cache metadata.EndDeviceAttributesCache `name:"-"`
Enable bool `name:"enable" description:"Enable caching of end device attributes"`
MinRefreshInterval time.Duration `name:"min-refresh-interval" description:"Minimum time interval between two asynchronous refreshes"`
MaxRefreshInterval time.Duration `name:"max-refresh-interval" description:"Maximum time interval between two asynchronous refreshes"`
TTL time.Duration `name:"eviction-ttl" description:"Time to live of cached attributes"`
Enable bool `name:"enable" description:"Enable caching of end device attributes"` // nolint:lll
MinRefreshInterval time.Duration `name:"min-refresh-interval" description:"Minimum time interval between two asynchronous refreshes"` // nolint:lll
MaxRefreshInterval time.Duration `name:"max-refresh-interval" description:"Maximum time interval between two asynchronous refreshes"` // nolint:lll
TTL time.Duration `name:"eviction-ttl" description:"Time to live of cached attributes"` // nolint:lll
}

// FormattersConfig represents the configuration for payload formatters.
type FormattersConfig struct {
MaxParameterLength int `name:"max-parameter-length" description:"Maximum allowed size for length of formatter parameters (payload formatter scripts)"`
MaxParameterLength int `name:"max-parameter-length" description:"Maximum allowed size for length of formatter parameters (payload formatter scripts)"` // nolint:lll
}

// ConfirmationConfig represents the configuration for confirmed downlink.
Expand All @@ -129,21 +129,21 @@ type PaginationConfig struct {

// Config represents the ApplicationServer configuration.
type Config struct {
LinkMode string `name:"link-mode" description:"Deprecated - mode to link applications to their Network Server (all, explicit)"`
LinkMode string `name:"link-mode" description:"Deprecated - mode to link applications to their Network Server (all, explicit)"` // nolint:lll
Devices DeviceRegistry `name:"-"`
Links LinkRegistry `name:"-"`
UplinkStorage UplinkStorageConfig `name:"uplink-storage" description:"Application uplinks storage configuration"`
Formatters FormattersConfig `name:"formatters" description:"Payload formatters configuration"`
Distribution DistributionConfig `name:"distribution" description:"Distribution configuration"`
EndDeviceFetcher EndDeviceFetcherConfig `name:"fetcher" description:"Deprecated - End Device fetcher configuration"`
EndDeviceMetadataStorage EndDeviceMetadataStorageConfig `name:"end-device-metadata-storage" description:"End device metadata storage configuration"`
EndDeviceFetcher EndDeviceFetcherConfig `name:"fetcher" description:"Deprecated - End Device fetcher configuration"` // nolint:lll
EndDeviceMetadataStorage EndDeviceMetadataStorageConfig `name:"end-device-metadata-storage" description:"End device metadata storage configuration"` // nolint:lll
MQTT config.MQTT `name:"mqtt" description:"MQTT configuration"`
Webhooks WebhooksConfig `name:"webhooks" description:"Webhooks configuration"`
PubSub PubSubConfig `name:"pubsub" description:"Pub/sub messaging configuration"`
Packages ApplicationPackagesConfig `name:"packages" description:"Application packages configuration"`
Interop InteropConfig `name:"interop" description:"Interop client configuration"`
DeviceKEKLabel string `name:"device-kek-label" description:"Label of KEK used to encrypt device keys at rest"`
DeviceLastSeen LastSeenConfig `name:"device-last-seen" description:"End Device last seen batch update configuration"`
DeviceKEKLabel string `name:"device-kek-label" description:"Label of KEK used to encrypt device keys at rest"` // nolint:lll
DeviceLastSeen LastSeenConfig `name:"device-last-seen" description:"End Device last seen batch update configuration"` // nolint:lll
Downlinks DownlinksConfig `name:"downlinks" description:"Downlink configuration"`
Pagination PaginationConfig `name:"pagination" description:"Pagination configuration"`
}
Expand All @@ -170,10 +170,10 @@ type UplinkStorageConfig struct {
type WebhooksConfig struct {
Registry web.WebhookRegistry `name:"-"`
Target string `name:"target" description:"Target of the integration (direct)"`
Timeout time.Duration `name:"timeout" description:"Wait timeout of the target to process the request"`
Timeout time.Duration `name:"timeout" description:"Wait timeout of the target to process the request"` // nolint:lll
QueueSize int `name:"queue-size" description:"Number of requests to queue"`
Workers int `name:"workers" description:"Number of workers to process requests"`
UnhealthyAttemptsThreshold int `name:"unhealthy-attempts-threshold" description:"Number of failed webhook attempts before the webhook is disabled"`
UnhealthyAttemptsThreshold int `name:"unhealthy-attempts-threshold" description:"Number of failed webhook attempts before the webhook is disabled"` // nolint:lll
UnhealthyRetryInterval time.Duration `name:"unhealthy-retry-interval" description:"Time interval after which disabled webhooks may execute again"`
Templates web.TemplatesConfig `name:"templates" description:"The store of the webhook templates"`
Downlinks web.DownlinksConfig `name:"downlink" description:"The downlink queue operations configuration"`
Expand Down Expand Up @@ -309,7 +309,10 @@ func (c PubSubConfig) NewPubSub(comp *component.Component, server io.Server) (*p

// NewApplicationPackages returns a new applications packages frontend based on the configuration.
// If the registry is nil, it returns nil.
func (c ApplicationPackagesConfig) NewApplicationPackages(ctx context.Context, server io.Server) (packages.Server, error) {
func (c ApplicationPackagesConfig) NewApplicationPackages(
ctx context.Context,
server io.Server,
) (packages.Server, error) {
if c.Registry == nil {
return nil, nil
}
Expand All @@ -333,7 +336,10 @@ var (
)

// NewRegistry returns a new end device location registry based on the configuration.
func (c EndDeviceLocationStorageConfig) NewRegistry(ctx context.Context, comp *component.Component) (metadata.EndDeviceLocationRegistry, error) {
func (c EndDeviceLocationStorageConfig) NewRegistry(
ctx context.Context,
comp *component.Component,
) (metadata.EndDeviceLocationRegistry, error) {
if c.Timeout <= 0 {
return nil, errInvalidTimeout.WithAttributes("timeout", c.Timeout)
}
Expand All @@ -346,13 +352,17 @@ func (c EndDeviceLocationStorageConfig) NewRegistry(ctx context.Context, comp *c
}
}
cache := metadata.NewMetricsEndDeviceLocationCache(c.Cache.Cache)
registry = metadata.NewCachedEndDeviceLocationRegistry(ctx, comp, registry, cache, c.Cache.MinRefreshInterval, c.Cache.MaxRefreshInterval, c.Cache.TTL)
registry = metadata.NewCachedEndDeviceLocationRegistry(
ctx, comp, registry, cache, c.Cache.MinRefreshInterval, c.Cache.MaxRefreshInterval, c.Cache.TTL)
}
return registry, nil
}

// NewRegistry returns a new end device attributes registry based on the configuration.
func (c EndDeviceAttributesStorageConfig) NewRegistry(ctx context.Context, comp *component.Component) (metadata.EndDeviceAttributesRegistry, error) {
func (c EndDeviceAttributesStorageConfig) NewRegistry(
ctx context.Context,
comp *component.Component,
) (metadata.EndDeviceAttributesRegistry, error) {
if c.Timeout <= 0 {
return nil, errInvalidTimeout.WithAttributes("timeout", c.Timeout)
}
Expand All @@ -365,7 +375,8 @@ func (c EndDeviceAttributesStorageConfig) NewRegistry(ctx context.Context, comp
}
}
cache := metadata.NewMetricsEndDeviceAttributesCache(c.Cache.Cache)
registry = metadata.NewCachedEndDeviceAttributesRegistry(ctx, comp, registry, cache, c.Cache.MinRefreshInterval, c.Cache.MaxRefreshInterval, c.Cache.TTL)
registry = metadata.NewCachedEndDeviceAttributesRegistry(
ctx, comp, registry, cache, c.Cache.MinRefreshInterval, c.Cache.MaxRefreshInterval, c.Cache.TTL)
}
return registry, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/webui/components/map/map.styl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

// stylelint-disable

:global {
:global {
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
Expand Down

0 comments on commit 846705a

Please sign in to comment.