mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
linters: Add modernise tool check and fix issues (#2012)
* linters: Add modernise tool check and fix issues * engine: Simplify exch.SetDefaults call and remove localWG * CI: Revert config versions lint workflow
This commit is contained in:
2
.github/workflows/config-versions-lint.yml
vendored
2
.github/workflows/config-versions-lint.yml
vendored
@@ -13,4 +13,4 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- name: Check config versions are continuous
|
||||
run: go test ./config/versions/ -tags config_versions -run Continuity
|
||||
run: go test ./config/versions/ -tags config_versions -run Continuity
|
||||
24
.github/workflows/configs-json-lint.yml
vendored
24
.github/workflows/configs-json-lint.yml
vendored
@@ -1,24 +0,0 @@
|
||||
name: configs-json-lint
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: configs JSON lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Check configs JSON format
|
||||
run: |
|
||||
files=("config_example.json" "testdata/configtest.json")
|
||||
for file in "${files[@]}"; do
|
||||
processed_file="${file%.*}_processed.${file##*.}"
|
||||
jq '.exchanges |= sort_by(.name)' --indent 1 $file > $processed_file
|
||||
if ! diff $file $processed_file; then
|
||||
echo "jq differences found in $file! Please run 'make lint_configs'"
|
||||
exit 1
|
||||
else
|
||||
rm $processed_file
|
||||
echo "No differences found in $file 🌞"
|
||||
fi
|
||||
done
|
||||
25
.github/workflows/misc.yml
vendored
25
.github/workflows/misc.yml
vendored
@@ -6,6 +6,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.25.x
|
||||
|
||||
- name: Check for currency.NewPair(BTC, USD) used instead of currency.NewBTCUSD
|
||||
run: |
|
||||
grep -r -n --color=always -E "currency.NewPair\(currency.BTC, currency.USDT?\)" * || exit 0
|
||||
@@ -62,4 +67,24 @@ jobs:
|
||||
grep -r -n -I --color=always --exclude-dir=.git -P "$PATTERN" . || exit 0
|
||||
echo "::error::Remove zero-width/format, separator or combining-mark characters"
|
||||
exit 1
|
||||
|
||||
- name: Check configs JSON format
|
||||
run: |
|
||||
files=("config_example.json" "testdata/configtest.json")
|
||||
for file in "${files[@]}"; do
|
||||
processed_file="${file%.*}_processed.${file##*.}"
|
||||
jq '.exchanges |= sort_by(.name)' --indent 1 $file > $processed_file
|
||||
if ! diff $file $processed_file; then
|
||||
echo "jq differences found in $file! Please run 'make lint_configs'"
|
||||
exit 1
|
||||
else
|
||||
rm $processed_file
|
||||
echo "No differences found in $file 🌞"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Check Go modernise tool issues
|
||||
run: |
|
||||
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test ./...
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user