Skip to content

Latest commit

 

History

History
113 lines (74 loc) · 2.57 KB

contribute.md

File metadata and controls

113 lines (74 loc) · 2.57 KB
keywords description image
Smart Contracts
Contribute
Pull Request
Linting
Go-lang
golangci-lint
How to contribute to IOTA Smart Contracts. Creating a PR, setting up golangci-lint.
/img/logo/WASP_logo_dark.png

Contributing

If you want to contribute to this repository, consider posting a bug report, feature request or a pull request.

You can also join our Discord server and ping us in #smartcontracts-dev.

Creating a Pull Request

Please base your work on the develop branch.

Before creating the Pull Request ensure that:

  • all the tests pass:

    go test -tags rocksdb,builtin_static ./...

    or

    make test

    If the changes are major, please run even the heavy tests:

    make test-full

    Note, that these tests might take longer to run (they timeout after 60 minutes). Also note that TestSpamOffledger should only be run with database.inMemory set to false. See tools/cluster/tests/spam_test.go for details.

  • there are no linting violations (instructions on how to setup linting below):

    golangci-lint run

    or

    make lint

    Note, that linter is run each time you run

    make

Lint Setup

  1. Install golintci:

    https://golangci-lint.run/usage/install/#local-installation

  2. Dev setup:

    https://golangci-lint.run/usage/integrations/#editor-integration

    VSCode:

    // required:
    "go.lintTool": "golangci-lint",
    // recommended:
    "go.lintOnSave": "package"
    "go.lintFlags": ["--fix"],
    "editor.formatOnSave": true,

    GoLand:

    • Install golintci plugin

      Install golintci plugin

    • Configure path for golangci

      Configure path for golangci

    • Add a golangci file watcher with custom command (I recommend using --fix)

      Add a golangci file watcher with custom command

    Other editors: please look into the golangci official documentation.

  3. Ignoring false positives:

    https://golangci-lint.run/usage/false-positives/

    //nolint

    for specific rules:

    //nolint:golint,unused