Skip to content

Commit 8845d07

Browse files
committed
Remove double lint-rule exclusion.
1 parent 625388a commit 8845d07

File tree

16 files changed

+41
-39
lines changed

16 files changed

+41
-39
lines changed

cli/data.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,12 +742,12 @@ func (c *viamClient) tabularData(dest string, request *datapb.ExportTabularDataR
742742
ctx, cancel := context.WithCancel(context.Background())
743743

744744
defer func() {
745-
writer.Flush() //nolint:errcheck,gosec
746-
dataFile.Close() //nolint:errcheck,gosec
745+
writer.Flush() //nolint:errcheck
746+
dataFile.Close() //nolint:errcheck
747747
cancel()
748748

749749
if exportErr != nil {
750-
os.Remove(dataFile.Name()) //nolint:errcheck,gosec
750+
os.Remove(dataFile.Name()) //nolint:errcheck
751751
}
752752
}()
753753

cli/module_build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (c *viamClient) moduleBuildListAction(cCtx *cli.Context, args moduleBuildLi
235235
job.StartTime.AsTime().Format(time.RFC3339))
236236
}
237237
// the table is not printed to stdout until the tabwriter is flushed
238-
//nolint: errcheck,gosec
238+
//nolint:errcheck
239239
w.Flush()
240240
return nil
241241
}
@@ -700,7 +700,7 @@ func (c *viamClient) loadGitignorePatterns(repoPath string) (gitignore.Matcher,
700700
return nil, errors.Wrap(err, "failed to open .gitignore file")
701701
}
702702
defer func() {
703-
//nolint:errcheck,gosec // Ignore close error for read-only file
703+
//nolint:errcheck
704704
file.Close()
705705
}()
706706

components/board/genericlinux/buses/i2c.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616

1717
func init() {
1818
if _, err := host.Init(); err != nil {
19-
//nolint:gosec
2019
fmtnolint.Println("Error initializing host:", err)
2120
}
2221
}

etc/.golangci.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ linters:
6060
- testpackage
6161
- thelper # false positives
6262
- tparallel # there are valid reasons to have top-level t.Parallel() but serial subtests
63+
- unparam # not useful
6364
- varnamelen
6465
- wrapcheck
6566
- wsl
@@ -81,6 +82,7 @@ linters-settings:
8182
- composites
8283
gosec:
8384
excludes:
85+
- G104 # Unhandled errors. These are already linted on, no need to double lint.
8486
- G115 # TODO(go1.23): maybe reenable
8587
revive:
8688
# Unfortunately configuring a single rules disables all other rules, even
@@ -120,6 +122,14 @@ linters-settings:
120122
- ifElseChain
121123
gomoddirectives:
122124
replace-allow-list: [github.com/hashicorp/go-getter]
125+
stylecheck:
126+
checks:
127+
- all
128+
- "-ST1005" # Low value complaint. Can remove when gosimple rewrites code in place instead of failing.
129+
gosimple:
130+
checks:
131+
- all
132+
- "-S1002" # Low value complaint. Can remove when gosimple rewrites code in place instead of failing.
123133
issues:
124134
exclude-rules:
125135
- path: _test\.go$

ftdc/custom_format.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func writeSchema(schema *schema, output io.Writer) error {
6363
func writeDatum(time int64, prev, curr []float32, output io.Writer) error {
6464
numPts := len(curr)
6565
if len(prev) != 0 && numPts != len(prev) {
66-
//nolint:stylecheck
6766
return fmt.Errorf("Bad input sizes. Prev: %v Curr: %v", len(prev), len(curr))
6867
}
6968

@@ -234,7 +233,7 @@ func flattenMap(mValue reflect.Value) ([]string, []float32, error) {
234233
}
235234
numbers = append(numbers, subNumbers...)
236235
case isNumeric(value.Kind()):
237-
//nolint:stylecheck
236+
238237
return nil, nil, fmt.Errorf("A numeric type was forgotten to be included. Kind: %v", value.Kind())
239238
default:
240239
// Getting the keys for a structure will ignore these types. Such as the antagonistic
@@ -298,7 +297,7 @@ func flattenStruct(value reflect.Value) ([]string, []float32, error) {
298297

299298
numbers = append(numbers, subNumbers...)
300299
case isNumeric(rField.Kind()):
301-
//nolint:stylecheck
300+
302301
return nil, nil, fmt.Errorf("A numeric type was forgotten to be included. Kind: %v", rField.Kind())
303302
default:
304303
// Getting the keys for a structure will ignore these types. Such as the antagonistic
@@ -599,7 +598,6 @@ func readDiffBits(reader *bufio.Reader, schema *schema) ([]int, error) {
599598
// is the post-hydration list and consequently matches the `schema.fieldOrder` size.
600599
func readData(reader *bufio.Reader, schema *schema, diffedFields []int, prevValues []float32) ([]float32, error) {
601600
if prevValues != nil && len(prevValues) != len(schema.fieldOrder) {
602-
//nolint
603601
return nil, fmt.Errorf("Parser error. Mismatched `prevValues` and schema size. PrevValues: %d Schema: %d",
604602
len(prevValues), len(schema.fieldOrder))
605603
}

module/module.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func NewModule(ctx context.Context, address string, logger logging.Logger) (*Mod
194194
if err != nil {
195195
return nil, err
196196
}
197-
//nolint: errcheck, gosec
197+
//nolint:errcheck
198198
trace.SetProvider(
199199
ctx,
200200
sdktrace.WithResource(

motionplan/armplanning/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func ValidatePlan(
247247
if len(worldStateOverride.Obstacles()) > 0 && validateErrorOnce.Load() == false {
248248
logger.Info("Validate plan returning collision")
249249
validateErrorOnce.Store(true)
250-
return errors.New("Will collide.")
250+
return errors.New("will collide")
251251
}
252252

253253
return nil

motionplan/armplanning/cmd-plan/cmd-plan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func realMain() error {
131131
}
132132

133133
spansExporter := perf.NewOtelDevelopmentExporter()
134-
//nolint: errcheck, gosec
134+
//nolint:errcheck
135135
trace.SetProvider(ctx, sdktrace.WithResource(otelresource.Empty()))
136136
trace.AddExporters(spansExporter)
137137

referenceframe/frame_system.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ func NewFrameSystem(name string, parts []*FrameSystemPart, additionalTransforms
8383
strs[idx] = part.FrameConfig.Name()
8484
}
8585

86-
//nolint
8786
return nil, fmt.Errorf("Cannot construct frame system. Some parts are not linked to the world frame. Parts: %v",
8887
strs)
8988
}

referenceframe/worldstate.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,8 @@ func (ws *WorldState) Merge(geomsInFrame *GeometriesInFrame) *WorldState {
9696
ret.obstacleNames[name] = true
9797
}
9898

99-
for _, geomInFrame := range ws.obstacles {
100-
ret.obstacles = append(ret.obstacles, geomInFrame)
101-
}
102-
103-
for _, transform := range ws.transforms {
104-
ret.transforms = append(ret.transforms, transform)
105-
}
99+
ret.obstacles = append(ret.obstacles, ws.obstacles...)
100+
ret.transforms = append(ret.transforms, ws.transforms...)
106101

107102
if len(geomsInFrame.Geometries()) > 0 {
108103
// Avoid adding a bag of empty geometries. Such that `len(worldState.Obstacles())` returns 0

0 commit comments

Comments
 (0)