Skip to content
This repository was archived by the owner on Jun 29, 2024. It is now read-only.

Commit 909839c

Browse files
committed
Minor linter and typo fixes
1 parent f6469c2 commit 909839c

23 files changed

+60
-24
lines changed

.golangci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
run:
2+
# timeout for analysis, e.g. 30s, 5m, default is 1m
3+
timeout: 5m
4+
5+
# include test files or not, default is true
6+
tests: true
7+
8+
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
9+
# If invoked with -mod=readonly, the go command is disallowed from the implicit
10+
# automatic updating of go.mod described above. Instead, it fails when any changes
11+
# to go.mod are needed. This setting is most useful to check that go.mod does
12+
# not need updates, such as in a continuous integration and testing system.
13+
# If invoked with -mod=vendor, the go command assumes that the vendor
14+
# directory holds the correct copies of dependencies and ignores
15+
# the dependency descriptions in go.mod.
16+
modules-download-mode: readonly
17+
18+
# output configuration options
19+
output:
20+
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
21+
formats:
22+
- format: colored-line-number
23+
24+
linters:
25+
enable:
26+
- bodyclose
27+
- errcheck
28+
- errorlint
29+
- gocheckcompilerdirectives
30+
- gochecknoinits
31+
- gochecksumtype
32+
- goconst
33+
- gofmt
34+
- gosimple
35+
- gosec
36+
- govet
37+
- nilerr
38+
- nilnil
39+
- staticcheck
40+
- typecheck
41+
- unused
42+
- whitespace
43+
44+
issues:
45+
# Excluding configuration per-path, per-linter, per-text and per-source
46+
exclude-rules:
47+
# Exclude some linters from running on tests files.
48+
- path: _test\.go
49+
linters:
50+
- errcheck
51+
- goconst
52+
- gosec
53+
54+
# checking for errors in defers seldom makes sense...
55+
- source: "^\\s*defer\\s"
56+
linters:
57+
- errcheck
58+
- staticcheck

cem/events.go

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

88
// handle SPINE events
99
func (h *Cem) HandleEvent(payload spineapi.EventPayload) {
10-
1110
if util.IsDeviceConnected(payload) {
1211
h.eventCB(payload.Ski, payload.Device, DeviceConnected)
1312
return

uccevc/events.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ func (e *UCCEVC) evIncentiveTableDescriptionDataUpdate(payload spineapi.EventPay
156156
if e.evCheckIncentiveTableDescriptionUpdateRequired(payload.Entity) {
157157
e.eventCB(payload.Ski, payload.Device, payload.Entity, DataRequestedIncentiveTableDescription)
158158
}
159-
160159
}
161160

162161
// the incentive table constraint data of an EV was updated

uccevc/events_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,4 @@ func (s *UCCEVCSuite) Test_evTimeSeriesDescriptionDataUpdate() {
158158
assert.Nil(s.T(), fErr)
159159

160160
s.sut.evTimeSeriesDescriptionDataUpdate(payload)
161-
162161
}

uccevc/public_scen1.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func (e *UCCEVC) ChargeStrategy(entity spineapi.EntityRemoteInterface) api.EVCha
6363

6464
return api.EVChargeStrategyTypeNoDemand
6565
}
66-
6766
}
6867

6968
return api.EVChargeStrategyTypeUnknown

uccevc/public_scen3_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ func (s *UCCEVCSuite) Test_WriteIncentives() {
203203
for _, tc := range tests {
204204
s.T().Run(tc.name, func(t *testing.T) {
205205
for _, data := range tc.data {
206-
207206
constData = &model.IncentiveTableConstraintsDataType{
208207
IncentiveTableConstraints: []model.IncentiveTableConstraintsType{
209208
{

uccevc/public_scen4.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func (e *UCCEVC) ChargePlan(entity spineapi.EntityRemoteInterface) (api.ChargePl
9292
currentStart := time.Now()
9393
currentEnd := currentStart
9494
if data.TimePeriod != nil && data.TimePeriod.StartTime != nil {
95-
9695
if start, err := data.TimePeriod.StartTime.GetTimeDuration(); err == nil {
9796
currentStart = currentStart.Add(start)
9897
startAvailable = true

uccevc/public_scen4_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ func (s *UCCEVCSuite) Test_ChargePlanConstaints() {
7878

7979
_, err = s.sut.ChargePlanConstraints(s.evEntity)
8080
assert.Nil(s.T(), err)
81-
8281
}
8382

8483
func (s *UCCEVCSuite) Test_ChargePlan() {

ucevcc/events.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ func (e *UCEVCC) evManufacturerDataUpdate(payload spineapi.EventPayload) {
187187
if _, err := evDeviceClassification.GetManufacturerDetails(); err == nil {
188188
e.eventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateManufacturerData)
189189
}
190-
191190
}
192191

193192
// the electrical connection parameter description data of an EV was updated

ucevcc/public.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (e *UCEVCC) ChargeState(entity spineapi.EntityRemoteInterface) (api.EVCharg
1616

1717
evDeviceDiagnosis, err := util.DeviceDiagnosis(e.service, entity)
1818
if err != nil {
19-
return api.EVChargeStateTypeUnplugged, nil
19+
return api.EVChargeStateTypeUnplugged, err
2020
}
2121

2222
diagnosisState, err := evDeviceDiagnosis.GetState()
@@ -201,7 +201,6 @@ func (e *UCEVCC) ManufacturerData(
201201
api.ManufacturerData,
202202
error,
203203
) {
204-
205204
return util.ManufacturerData(e.service, entity, e.validEntityTypes)
206205
}
207206

0 commit comments

Comments
 (0)