-
Notifications
You must be signed in to change notification settings - Fork 62
Feat/remove deprecated pre commit repo #290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: golangci-lint | ||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [master, dev] | ||
| permissions: | ||
| contents: read | ||
| # Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| golangci: | ||
| name: lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: "go.mod" | ||
| check-latest: true | ||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@v6 | ||
| with: | ||
| # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
| version: latest | ||
|
|
||
| # Optional: working directory, useful for monorepos | ||
| # working-directory: somedir | ||
|
|
||
| # Optional: golangci-lint command line arguments. | ||
| args: --timeout=15m -v | ||
|
|
||
| # Optional: show only new issues if it's a pull request. The default value is `false`. | ||
| only-new-issues: false | ||
|
|
||
| # Optional: if set to true then the all caching functionality will be complete disabled, | ||
| # takes precedence over all other caching options. | ||
| # skip-cache: true | ||
|
|
||
| # Optional: if set to true then the action don't cache or restore ~/go/pkg. | ||
| skip-cache: true | ||
|
|
||
| # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. | ||
| # skip-build-cache: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,14 +8,11 @@ jobs: | |
| pre-commit: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/setup-python@v4 | ||
| - uses: actions/checkout@master | ||
| - uses: actions/checkout@v3 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify the checkout action version. The 🌐 Web query: 💡 Result: The latest stable version of the For most workflows, you can implement it with: - uses: actions/checkout@v4Key updates in recent versions:
Always check the official repository for new releases, as GitHub periodically updates actions to maintain compatibility with platform changes[6]. Citations:
Action Required: Update GitHub Checkout Action Version File: The workflow currently uses: - uses: actions/checkout@v3Based on the latest information, the current stable version of the checkout action is v4. This update addresses Node.js compatibility (switching to Node.js 20), improves security practices, and enhances overall reliability. Please update the workflow step to: - uses: actions/checkout@v4🧰 Tools🪛 actionlint (1.7.4)11-11: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) |
||
| with: | ||
| fetch-depth: 2 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: "go.mod" | ||
| check-latest: true | ||
| - run: go install golang.org/x/tools/cmd/goimports@latest | ||
| - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0 | ||
| - uses: pre-commit/action@v2.0.2 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,48 @@ | ||
| { | ||
| "run": { | ||
| "tests": false, | ||
| }, | ||
| "linters": { | ||
| "fast": false, | ||
| "enable": [ | ||
| "errcheck", | ||
| "errorlint", | ||
| "gas", | ||
| "gocritic", | ||
| "gosimple", | ||
| "govet", | ||
| "ineffassign", | ||
| "megacheck", | ||
| "misspell", | ||
| "nakedret", | ||
| "prealloc", | ||
| "revive", | ||
| "staticcheck", | ||
| "unconvert", | ||
| "unparam", | ||
| ], | ||
| "disable": [ | ||
| "unused", | ||
| ] | ||
| }, | ||
| "linters-settings": { | ||
| "revive": { | ||
| "enableAllRules": true, | ||
| "rules": [ | ||
| { | ||
| "name": "var-naming", | ||
| "arguments": [ | ||
| ["ID"] | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "gocritic": { | ||
| "enabled-tags": [ | ||
| "diagnostic", | ||
| "experimental", | ||
| "opinionated", | ||
| "performance", | ||
| "style", | ||
| ], | ||
| "disabled-checks": [ | ||
| "hugeParam", | ||
| "unnamedResult", | ||
| ] | ||
| } | ||
| }, | ||
| } | ||
| run: | ||
| tests: false | ||
| skip-dirs: | ||
| - chain | ||
| - exchange | ||
| - injective_data | ||
| - proto | ||
|
|
||
| linters: | ||
| fast: false | ||
| enable: | ||
| - errcheck | ||
| - errorlint | ||
| - gas | ||
| - gocritic | ||
| - gofmt | ||
| - goimports | ||
| - gosimple | ||
| - govet | ||
| - ineffassign | ||
| - megacheck | ||
| - misspell | ||
| - nakedret | ||
| - prealloc | ||
| - revive | ||
| - staticcheck | ||
| - unconvert | ||
| - unparam | ||
| disable: | ||
| - unused | ||
|
|
||
| linters-settings: | ||
| revive: | ||
| enableAllRules: true | ||
| rules: | ||
| - name: var-naming | ||
| arguments: | ||
| - ["ID"] | ||
| gocritic: | ||
| enabled-tags: | ||
| - diagnostic | ||
| - experimental | ||
| - opinionated | ||
| - performance | ||
| - style | ||
| disabled-checks: | ||
| - hugeParam | ||
| - unnamedResult |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,14 @@ | |
| "bytes" | ||
| "encoding/json" | ||
| "fmt" | ||
| "math" | ||
| "math/big" | ||
| "reflect" | ||
| "runtime/debug" | ||
| "strings" | ||
| "time" | ||
|
|
||
| "cosmossdk.io/math" | ||
| sdkmath "cosmossdk.io/math" | ||
| "github.com/cosmos/cosmos-sdk/codec" | ||
| codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
| cosmtypes "github.com/cosmos/cosmos-sdk/types" | ||
|
|
@@ -64,6 +65,12 @@ | |
| []cosmtypes.Msg{}, memo, | ||
| ) | ||
|
|
||
| if chainID > uint64(math.MaxInt64) { | ||
| err := fmt.Errorf("chainID is too large: %s (max supported value is %s)", chainID, math.MaxInt64) | ||
| return typeddata.TypedData{}, err | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix formatting in error messages. The error messages use incorrect format specifier for uint64 values. Apply this fix to both error messages: -err := fmt.Errorf("chainID is too large: %s (max supported value is %s)", chainID, math.MaxInt64)
+err := fmt.Errorf("chainID is too large: %d (max supported value is %d)", chainID, math.MaxInt64)Also applies to: 542-545 🧰 Tools🪛 GitHub Check: lint[failure] 69-69: 🪛 GitHub Actions: golangci-lint[error] 69-69: printf: fmt.Errorf format %s has arg chainID of wrong type uint64 (govet) |
||
| intChainId := int64(chainID) | ||
|
|
||
| txData := make(map[string]interface{}) | ||
| if err := json.Unmarshal(data, &txData); err != nil { | ||
| err = errors.Wrap(err, "failed to unmarshal data provided into WrapTxToEIP712") | ||
|
|
@@ -98,7 +105,7 @@ | |
| domain := typeddata.TypedDataDomain{ | ||
| Name: "Injective Web3", | ||
| Version: "1.0.0", | ||
| ChainId: ethmath.NewHexOrDecimal256(int64(chainID)), | ||
| ChainId: ethmath.NewHexOrDecimal256(intChainId), | ||
| VerifyingContract: "cosmos", | ||
| Salt: "0", | ||
| } | ||
|
|
@@ -413,7 +420,7 @@ | |
| hashType = reflect.TypeOf(common.Hash{}) | ||
| addressType = reflect.TypeOf(common.Address{}) | ||
| bigIntType = reflect.TypeOf(big.Int{}) | ||
| cosmIntType = reflect.TypeOf(math.Int{}) | ||
| cosmIntType = reflect.TypeOf(sdkmath.Int{}) | ||
| cosmosAnyType = reflect.TypeOf(&codectypes.Any{}) | ||
| timeType = reflect.TypeOf(time.Time{}) | ||
| ) | ||
|
|
@@ -531,10 +538,17 @@ | |
| msgs []cosmtypes.Msg, | ||
| feeDelegation *FeeDelegationOptions, | ||
| ) (typeddata.TypedData, error) { | ||
|
|
||
| if chainID > uint64(math.MaxInt64) { | ||
| err := fmt.Errorf("chainID is too large: %s (max supported value is %s)", chainID, math.MaxInt64) | ||
| return typeddata.TypedData{}, err | ||
| } | ||
| intChainId := int64(chainID) | ||
|
|
||
| domain := typeddata.TypedDataDomain{ | ||
| Name: "Injective Web3", | ||
| Version: "1.0.0", | ||
| ChainId: ethmath.NewHexOrDecimal256(int64(chainID)), | ||
| ChainId: ethmath.NewHexOrDecimal256(intChainId), | ||
| VerifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", | ||
| Salt: "0", | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Update checkout action to latest version.
The
actions/checkoutaction should be updated to v4 for better compatibility and security.Apply this diff:
📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.4)
16-16: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)