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
This commit is contained in:
Gareth Kirwan
2025-01-31 02:46:43 +00:00
committed by GitHub
parent 070f17cab8
commit e6d456162a
7 changed files with 16 additions and 34 deletions

View File

@@ -1,4 +1,5 @@
[codespell]
skip = ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html
skip = ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html,./vendor
exclude-file = ./contrib/spellcheck/exclude_lines.txt
ignore-words = ./contrib/spellcheck/ignore_words.txt
ignore-words = ./contrib/spellcheck/ignore_words.txt
ignore-regex = currency\.\w+

View File

@@ -7,7 +7,3 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@master
with:
exclude_file: contrib/spellcheck/exclude_lines.txt
skip: ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html
ignore_words_file: contrib/spellcheck/ignore_words.txt

View File

@@ -211,36 +211,32 @@ func (s *GRPCServer) ExecuteStrategyFromFile(_ context.Context, request *btrpc.E
return nil, err
}
io64 := int64(request.IntervalOverride)
if io64 > 0 {
if io64 := int64(request.IntervalOverride); io64 > 0 {
if io64 < gctkline.FifteenSecond.Duration().Nanoseconds() {
return nil, fmt.Errorf("%w, interval must be >= 15 seconds, received '%v'", gctkline.ErrInvalidInterval, time.Duration(request.IntervalOverride))
}
cfg.DataSettings.Interval = gctkline.Interval(request.IntervalOverride)
}
sto := request.StartTimeOverride.AsTime()
if sto.Unix() != 0 && !sto.IsZero() {
if startTime := request.StartTimeOverride.AsTime(); startTime.Unix() != 0 && !startTime.IsZero() {
if cfg.DataSettings.DatabaseData != nil {
cfg.DataSettings.DatabaseData.StartDate = request.StartTimeOverride.AsTime()
cfg.DataSettings.DatabaseData.StartDate = startTime
} else if cfg.DataSettings.APIData != nil {
cfg.DataSettings.APIData.StartDate = request.StartTimeOverride.AsTime()
cfg.DataSettings.APIData.StartDate = startTime
}
}
eto := request.EndTimeOverride.AsTime()
if eto.Unix() != 0 && !eto.IsZero() {
if endTime := request.EndTimeOverride.AsTime(); endTime.Unix() != 0 && !endTime.IsZero() {
if cfg.DataSettings.DatabaseData != nil {
cfg.DataSettings.DatabaseData.EndDate = request.EndTimeOverride.AsTime()
cfg.DataSettings.DatabaseData.EndDate = endTime
} else if cfg.DataSettings.APIData != nil {
cfg.DataSettings.APIData.EndDate = request.EndTimeOverride.AsTime()
cfg.DataSettings.APIData.EndDate = endTime
}
}
err = cfg.Validate()
if err != nil {
if err := cfg.Validate(); err != nil {
return nil, err
}
if cfg == nil {
err = fmt.Errorf("%w backtester config", gctcommon.ErrNilPointer)
return nil, err
return nil, fmt.Errorf("%w backtester config", gctcommon.ErrNilPointer)
}
if !s.config.Report.GenerateReport {

View File

@@ -4,16 +4,6 @@
tt, errOt := order.StringToOrderType(genOrderDetail.Type)
if errOt != nil {
return order.Detail{}, fmt.Errorf("error parsing order type: %s", errOt)
currency.CANN: 0.2,
currency.DOTA: 0.01,
currency.SCRPT: 0.01,
currency.NOO: 0.002,
currency.BU: 0.1,
currency.HAV: 10,
currency.GARD: 100,
currency.DASHS: 0.01,
currency.ALIS: 0.05,
currency.MIS: 0.002,
const pressXToJSON = `[0,"bu",[4131.85,4131.85]]`
wsTradeExecuted = "te"
wsBalanceUpdate = "bu"
@@ -22,4 +12,4 @@
SHFT = NewCode("SHFT")
currency.SHFT: 84,
TotalIn float64 `json:"totalIn"`
TotalIn int64 `json:"totalIn"`
TotalIn int64 `json:"totalIn"`

View File

@@ -2,7 +2,6 @@ strat
datas
prevend
flate
freez
zar
insid
totalin

View File

@@ -1301,7 +1301,7 @@ type CrossMarginBalance struct {
BorrowedNet string `json:"borrowed_net"`
TotalNetAssetInUSDT string `json:"net"`
PositionLeverage string `json:"leverage"`
Risk string `json:"risk"` // Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: total / (borrowed+interest)
Risk string `json:"risk"` // Risk percentage; Liquidation is triggered when this falls below required margin. Calculation: total / (borrowed+interest)
}
// WalletSavedAddress represents currency saved address

View File

@@ -204,7 +204,7 @@ func (r *Requester) doRequest(ctx context.Context, endpoint EndpointLimit, newRe
return checkErr
} else if retry {
if err == nil {
// If the body isn't fully read, the connection cannot be re-used
// If the body isn't fully read, the connection cannot be reused
r.drainBody(resp.Body)
}