Skip to content

Commit 77260ec

Browse files
committed
fix linter issues
1 parent 60199ef commit 77260ec

98 files changed

Lines changed: 606 additions & 704 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

observability-lib/grafana/businessvariable/panel_builder.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder {
9292

9393
// Panel height. The height is the number of rows from the top edge of the panel.
9494
func (builder *PanelBuilder) Height(h uint32) *PanelBuilder {
95-
if !(h > 0) {
95+
if h <= 0 {
9696
builder.errors["h"] = cog.MakeBuildErrors("h", errors.New("h must be > 0"))
9797
return builder
9898
}
@@ -106,11 +106,11 @@ func (builder *PanelBuilder) Height(h uint32) *PanelBuilder {
106106

107107
// Panel width. The width is the number of columns from the left edge of the panel.
108108
func (builder *PanelBuilder) Span(w uint32) *PanelBuilder {
109-
if !(w > 0) {
109+
if w <= 0 {
110110
builder.errors["w"] = cog.MakeBuildErrors("w", errors.New("w must be > 0"))
111111
return builder
112112
}
113-
if !(w <= 24) {
113+
if w > 24 {
114114
builder.errors["w"] = cog.MakeBuildErrors("w", errors.New("w must be <= 24"))
115115
return builder
116116
}

observability-lib/grafana/polystat/panel_builder.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder {
9393

9494
// Panel height. The height is the number of rows from the top edge of the panel.
9595
func (builder *PanelBuilder) Height(h uint32) *PanelBuilder {
96-
if !(h > 0) {
96+
if h <= 0 {
9797
builder.errors["h"] = cog.MakeBuildErrors("h", errors.New("h must be > 0"))
9898
return builder
9999
}
@@ -107,11 +107,11 @@ func (builder *PanelBuilder) Height(h uint32) *PanelBuilder {
107107

108108
// Panel width. The width is the number of columns from the left edge of the panel.
109109
func (builder *PanelBuilder) Span(w uint32) *PanelBuilder {
110-
if !(w > 0) {
110+
if w <= 0 {
111111
builder.errors["w"] = cog.MakeBuildErrors("w", errors.New("w must be > 0"))
112112
return builder
113113
}
114-
if !(w <= 24) {
114+
if w > 24 {
115115
builder.errors["w"] = cog.MakeBuildErrors("w", errors.New("w must be <= 24"))
116116
return builder
117117
}

pkg/beholder/client_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,6 @@ func TestNewClient_Chip(t *testing.T) {
495495
assert.NotNil(t, client)
496496
assert.NotNil(t, client.Chip)
497497

498-
// Verify it implements the Client interface
499-
var _ chipingress.Client = client.Chip
500-
501498
// Verify the emitter is configured as dual source
502499
assert.NotNil(t, client.Emitter)
503500
assert.IsType(t, &beholder.DualSourceEmitter{}, client.Emitter)
@@ -514,9 +511,6 @@ func TestNewClient_Chip(t *testing.T) {
514511
assert.NotNil(t, client)
515512
assert.NotNil(t, client.Chip)
516513

517-
// Verify it implements the Client interface
518-
var _ chipingress.Client = client.Chip
519-
520514
// Verify emitter is not dual source when dual emitter is disabled
521515
assert.NotNil(t, client.Emitter)
522516
})

pkg/beholder/global_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ func TestGlobal(t *testing.T) {
3333
expectedMessageEmitter := beholder.NewNoopClient().Emitter
3434
assert.IsType(t, expectedMessageEmitter, messageEmitter)
3535

36-
var noopClientPtr *beholder.Client = noopClient
37-
assert.IsType(t, noopClientPtr, beholder.GetClient())
38-
assert.NotSame(t, noopClientPtr, beholder.GetClient())
36+
assert.IsType(t, noopClient, beholder.GetClient())
37+
assert.NotSame(t, noopClient, beholder.GetClient())
3938

4039
// Set beholder client so it will be accessible from anywhere through beholder functions
41-
beholder.SetClient(noopClientPtr)
42-
assert.Same(t, noopClientPtr, beholder.GetClient())
40+
beholder.SetClient(noopClient)
41+
assert.Same(t, noopClient, beholder.GetClient())
4342

4443
// After that use beholder functions to get logger, tracer, meter, messageEmitter
4544
logger, tracer, meter, messageEmitter = beholder.GetLogger(), beholder.GetTracer(), beholder.GetMeter(), beholder.GetEmitter()

pkg/beholder/noop_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ func TestNoopClient(t *testing.T) {
5555

5656
// Chip - verify noop chip client is initialized and functional
5757
assert.NotNil(t, noopClient.Chip)
58-
var _ chipingress.Client = noopClient.Chip
5958
assert.IsType(t, &chipingress.NoopClient{}, noopClient.Chip)
6059

6160
// Test Chip methods return no errors

pkg/billing/workflow_client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ type workflowClient struct {
4343
}
4444

4545
type workflowConfig struct {
46-
log logger.Logger
4746
transportCredentials credentials.TransportCredentials
4847
tlsCert string
4948
serverName string

pkg/capabilities/cli/cmd/generate_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func ConfigFromSchemas(schemaFilePaths []string) (ConfigInfo, error) {
179179
SchemaOutputFile: outputName,
180180
}
181181

182-
configInfo.Config.SchemaMappings = append(configInfo.Config.SchemaMappings, generator.SchemaMapping{
182+
configInfo.SchemaMappings = append(configInfo.SchemaMappings, generator.SchemaMapping{
183183
SchemaID: jsonSchema.ID,
184184
PackageName: path.Dir(jsonSchema.ID[8:]),
185185
RootType: rootType,

pkg/capabilities/cli/cmd/go_reader.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@ func (g *GoStructReader) gatherImports(node *ast.File, structs map[string]Struct
136136
}
137137
}
138138

139-
var allValues []string
140139
var imports []string
141-
var check []bool
142140
for _, imp := range node.Imports {
143141
var importName string
144142
if imp.Name != nil {
@@ -149,8 +147,6 @@ func (g *GoStructReader) gatherImports(node *ast.File, structs map[string]Struct
149147
}
150148
importName = strings.Trim(importName, "\"")
151149

152-
allValues = append(allValues, importName)
153-
check = append(check, requiredImports[importName])
154150
if requiredImports[importName] {
155151
imports = append(imports, imp.Path.Value)
156152
}

pkg/capabilities/consensus/ocr3/batching_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ func TestQueryBatchHasCapacity(t *testing.T) {
180180
t.Run(tt.name, func(t *testing.T) {
181181
// Handle special edge case tests that need dynamic size calculation
182182
sizeLimit := tt.sizeLimit
183-
if tt.name == "exactly at limit boundary" {
183+
switch tt.name {
184+
case "exactly at limit boundary":
184185
// Calculate exact size needed for the new ID
185186
newIdSize := calculateIdSize(tt.newId)
186187
if newIdSize > 0 {
@@ -190,7 +191,7 @@ func TestQueryBatchHasCapacity(t *testing.T) {
190191
} else {
191192
sizeLimit = 0
192193
}
193-
} else if tt.name == "one byte over limit" {
194+
case "one byte over limit":
194195
// Calculate exact size needed for the new ID minus 1
195196
newIdSize := calculateIdSize(tt.newId)
196197
if newIdSize > 0 {
@@ -1334,14 +1335,15 @@ func TestReportBatchHasCapacity(t *testing.T) {
13341335
t.Run(tt.name, func(t *testing.T) {
13351336
// Handle special edge case tests that need dynamic size calculation
13361337
sizeLimit := tt.sizeLimit
1337-
if tt.name == "exactly at limit boundary" {
1338+
switch tt.name {
1339+
case "exactly at limit boundary":
13381340
// Calculate exact size needed for the new report
13391341
newReportSize := calculateReportSize(tt.newReport)
13401342
// Always include tag and length overhead, even for empty messages
13411343
tagSize := varintSize(uint64(2<<3 | 2))
13421344
lengthSize := varintSize(uint64(newReportSize))
13431345
sizeLimit = tagSize + lengthSize + newReportSize
1344-
} else if tt.name == "one byte over limit" {
1346+
case "one byte over limit":
13451347
// Calculate exact size needed for the new report minus 1
13461348
newReportSize := calculateReportSize(tt.newReport)
13471349
// Always include tag and length overhead, even for empty messages

pkg/chainreader/contract_reader_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ func TestContractReaderByIDsQueryKey(t *testing.T) {
141141

142142
// Mock QueryKey function
143143
mockReader.queryKeyFunc = func(ctx context.Context, contract types.BoundContract, filter query.KeyFilter, limitAndSort query.LimitAndSort, sequenceDataType any) ([]types.Sequence, error) {
144-
if contract == bc1 {
144+
switch contract {
145+
case bc1:
145146
return []types.Sequence{{Data: "sequenceData1"}}, nil
146-
} else if contract == bc2 {
147+
case bc2:
147148
return []types.Sequence{{Data: "sequenceData2"}}, nil
148149
}
149150
return nil, fmt.Errorf("not found")

0 commit comments

Comments
 (0)