Skip to content

Commit e6d4561

Browse files
authored
Codespell: Fix failures with v2.4.0 (#1790)
* Codespell: Fix new violations in 2.4.0 * Codespell: Move currency ignoring to regex * Codespell: Add vendor to ignored files * Codespell: Remove github action params duplicated from .codespellrc .codespellrc already exists in the project * Codespell: Remove unused freez from ignore words
1 parent 070f17c commit e6d4561

File tree

7 files changed

+16
-34
lines changed

7 files changed

+16
-34
lines changed

.codespellrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[codespell]
2-
skip = ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html
2+
skip = ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html,./vendor
33
exclude-file = ./contrib/spellcheck/exclude_lines.txt
4-
ignore-words = ./contrib/spellcheck/ignore_words.txt
4+
ignore-words = ./contrib/spellcheck/ignore_words.txt
5+
ignore-regex = currency\.\w+

.github/workflows/spell-checker.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ jobs:
77
steps:
88
- uses: actions/checkout@v4
99
- uses: codespell-project/actions-codespell@master
10-
with:
11-
exclude_file: contrib/spellcheck/exclude_lines.txt
12-
skip: ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html
13-
ignore_words_file: contrib/spellcheck/ignore_words.txt

backtester/engine/grpcserver.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -211,36 +211,32 @@ func (s *GRPCServer) ExecuteStrategyFromFile(_ context.Context, request *btrpc.E
211211
return nil, err
212212
}
213213

214-
io64 := int64(request.IntervalOverride)
215-
if io64 > 0 {
214+
if io64 := int64(request.IntervalOverride); io64 > 0 {
216215
if io64 < gctkline.FifteenSecond.Duration().Nanoseconds() {
217216
return nil, fmt.Errorf("%w, interval must be >= 15 seconds, received '%v'", gctkline.ErrInvalidInterval, time.Duration(request.IntervalOverride))
218217
}
219218
cfg.DataSettings.Interval = gctkline.Interval(request.IntervalOverride)
220219
}
221-
sto := request.StartTimeOverride.AsTime()
222-
if sto.Unix() != 0 && !sto.IsZero() {
220+
221+
if startTime := request.StartTimeOverride.AsTime(); startTime.Unix() != 0 && !startTime.IsZero() {
223222
if cfg.DataSettings.DatabaseData != nil {
224-
cfg.DataSettings.DatabaseData.StartDate = request.StartTimeOverride.AsTime()
223+
cfg.DataSettings.DatabaseData.StartDate = startTime
225224
} else if cfg.DataSettings.APIData != nil {
226-
cfg.DataSettings.APIData.StartDate = request.StartTimeOverride.AsTime()
225+
cfg.DataSettings.APIData.StartDate = startTime
227226
}
228227
}
229-
eto := request.EndTimeOverride.AsTime()
230-
if eto.Unix() != 0 && !eto.IsZero() {
228+
if endTime := request.EndTimeOverride.AsTime(); endTime.Unix() != 0 && !endTime.IsZero() {
231229
if cfg.DataSettings.DatabaseData != nil {
232-
cfg.DataSettings.DatabaseData.EndDate = request.EndTimeOverride.AsTime()
230+
cfg.DataSettings.DatabaseData.EndDate = endTime
233231
} else if cfg.DataSettings.APIData != nil {
234-
cfg.DataSettings.APIData.EndDate = request.EndTimeOverride.AsTime()
232+
cfg.DataSettings.APIData.EndDate = endTime
235233
}
236234
}
237-
err = cfg.Validate()
238-
if err != nil {
235+
if err := cfg.Validate(); err != nil {
239236
return nil, err
240237
}
241238
if cfg == nil {
242-
err = fmt.Errorf("%w backtester config", gctcommon.ErrNilPointer)
243-
return nil, err
239+
return nil, fmt.Errorf("%w backtester config", gctcommon.ErrNilPointer)
244240
}
245241

246242
if !s.config.Report.GenerateReport {

contrib/spellcheck/exclude_lines.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@
44
tt, errOt := order.StringToOrderType(genOrderDetail.Type)
55
if errOt != nil {
66
return order.Detail{}, fmt.Errorf("error parsing order type: %s", errOt)
7-
currency.CANN: 0.2,
8-
currency.DOTA: 0.01,
9-
currency.SCRPT: 0.01,
10-
currency.NOO: 0.002,
11-
currency.BU: 0.1,
12-
currency.HAV: 10,
13-
currency.GARD: 100,
14-
currency.DASHS: 0.01,
15-
currency.ALIS: 0.05,
16-
currency.MIS: 0.002,
177
const pressXToJSON = `[0,"bu",[4131.85,4131.85]]`
188
wsTradeExecuted = "te"
199
wsBalanceUpdate = "bu"
@@ -22,4 +12,4 @@
2212
SHFT = NewCode("SHFT")
2313
currency.SHFT: 84,
2414
TotalIn float64 `json:"totalIn"`
25-
TotalIn int64 `json:"totalIn"`
15+
TotalIn int64 `json:"totalIn"`

contrib/spellcheck/ignore_words.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ strat
22
datas
33
prevend
44
flate
5-
freez
65
zar
76
insid
87
totalin

exchanges/gateio/gateio_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ type CrossMarginBalance struct {
13011301
BorrowedNet string `json:"borrowed_net"`
13021302
TotalNetAssetInUSDT string `json:"net"`
13031303
PositionLeverage string `json:"leverage"`
1304-
Risk string `json:"risk"` // Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: total / (borrowed+interest)
1304+
Risk string `json:"risk"` // Risk percentage; Liquidation is triggered when this falls below required margin. Calculation: total / (borrowed+interest)
13051305
}
13061306

13071307
// WalletSavedAddress represents currency saved address

exchanges/request/request.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (r *Requester) doRequest(ctx context.Context, endpoint EndpointLimit, newRe
204204
return checkErr
205205
} else if retry {
206206
if err == nil {
207-
// If the body isn't fully read, the connection cannot be re-used
207+
// If the body isn't fully read, the connection cannot be reused
208208
r.drainBody(resp.Body)
209209
}
210210

0 commit comments

Comments
 (0)