Skip to content

Commit

Permalink
chore: fix linting (#338)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Tsitrin <[email protected]>
  • Loading branch information
ItayLevyOfficial and mtsitrin authored Oct 15, 2023
1 parent 230afd0 commit dce1f1f
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 34 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/lint.yml → .github/workflows/golangci_lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linters
name: golangci-lint
on:
push:
tags:
Expand All @@ -9,7 +9,7 @@ on:

jobs:
golangci:
name: lint
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -19,13 +19,6 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.49
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: markdownlint-cli
uses: nosborn/[email protected]
with:
files: .
config-file: .markdownlint.yaml
config-path: .golangci.yml
version: v1.49.0
skip-cache: true
20 changes: 20 additions & 0 deletions .github/workflows/markdown_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: markdown-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:

jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: markdownlint-cli
uses: nosborn/[email protected]
with:
files: .
config_file: .markdownlint.yaml
ignore_files: ./x/gamm/**/*
11 changes: 2 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
run:
timeout: 5m
modules-download-mode: readonly
# mempool and indexer code is borrowed from Tendermint
skip-dirs:
- mempool
- state/indexer
- state/txindex
- vue
skip-files:
- da/celestia/mock/server.go
- ./*_test.go
Expand All @@ -20,12 +14,9 @@ linters:
- revive
- deadcode
- errcheck
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- misspell
- staticcheck
- structcheck
- typecheck
Expand All @@ -36,6 +27,8 @@ linters:

issues:
exclude-use-default: false
exclude:
- "^.*SA1019.*$" # Excluding SA1019 errors

linters-settings:
revive:
Expand Down
25 changes: 20 additions & 5 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
default: true
MD010:
code_blocks: false

MD010: false
MD013: false
MD024:
allow_different_nesting: true
MD024: false
MD033:
allowed_elements: ["img"]
allowed_elements: ["img", "a"]
MD041: false
MD037: false
MD034: false
MD009: false
MD004: false
MD012: false
MD022: false
MD026: false
MD028: false
MD029: false
MD031: false
MD032: false
MD036: false
MD047: false
MD051: false
MD053: false

9 changes: 5 additions & 4 deletions osmoutils/sdkrand.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,24 @@ import (
"math/rand"
"time"

sdk_math "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
)

// RandPositiveInt get a rand positive sdk.Int
func RandPositiveInt(r *rand.Rand, max sdk.Int) (sdk.Int, error) {
func RandPositiveInt(r *rand.Rand, max sdk_math.Int) (sdk_math.Int, error) {
if !max.GTE(sdk.OneInt()) {
return sdk.Int{}, errors.New("max too small")
return sdk_math.Int{}, errors.New("max too small")
}

max = max.Sub(sdk.OneInt())

return sdk.NewIntFromBigInt(new(big.Int).Rand(r, max.BigInt())).Add(sdk.OneInt()), nil
return sdk_math.NewIntFromBigInt(new(big.Int).Rand(r, max.BigInt())).Add(sdk_math.OneInt()), nil
}

// RandomAmount generates a random amount
// Note: The range of RandomAmount includes max, and is, in fact, biased to return max as well as 0.
func RandomAmount(r *rand.Rand, max sdk.Int) sdk.Int {
func RandomAmount(r *rand.Rand, max sdk_math.Int) sdk_math.Int {
randInt := big.NewInt(0)

switch r.Intn(10) {
Expand Down
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,13 @@ dymd start

You should have a running local node!


## Adding liquidity

TODO:
to play around with the `GAMM` module:

```sh
sh scripts/pools/osmosis_bootstrap.sh
```


If you have any issues please contact us on [discord](http://discord.gg/dymension) in the Developer section. We are here for you!
4 changes: 2 additions & 2 deletions x/gamm/types/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
)

func MustGetPoolIdFromShareDenom(denom string) uint64 {
numberStr := strings.TrimLeft(denom, "gamm/pool/")
numberStr := strings.TrimLeft(denom, "gamm/pool/") //nolint:staticcheck
number, err := strconv.Atoi(numberStr)
if err != nil {
panic(err)
Expand All @@ -38,7 +38,7 @@ func MustGetPoolIdFromShareDenom(denom string) uint64 {
}

func ValidatePoolShareDenom(denom string) error {
numberStr := strings.TrimLeft(denom, "gamm/pool/")
numberStr := strings.TrimLeft(denom, "gamm/pool/") //nolint:staticcheck
_, err := strconv.Atoi(numberStr)
if err != nil {
return err
Expand Down

0 comments on commit dce1f1f

Please sign in to comment.