3 releases (breaking)

0.2.1 Nov 22, 2023
0.1.1 Nov 6, 2023
0.0.2 Oct 20, 2023

#38 in #linting

GPL-3.0-or-later

170KB
4.5K SLoC

This is an open source project for linting Solidity code. This project provides Style Guide validations.

Installation

cargo install solidhunter

Usage

First initialize a configuration file, if you don't have one:

solidhunter --init

This will create a .solidhunter.json file with the default rules enabled.

Run solidhunter without arguments to get more information:

Usage: solidhunter [OPTIONS]

Options:
  -p, --path <PROJECT_PATH>    Specify project path [default: .]
  -e, --exclude <IGNORE_PATH>  Exclude part of the project path
  -r, --rules <RULES_FILE>     Specify rules file [default: .solidhunter.json]
  -v, --verbose                Verbose output
  -i, --init                   Initialize rules file
  -h, --help                   Print help information
  -V, --version                Print version information
  -g, --ignore                 Specify ignore file

Configuration

You can use a .solidhunter.json file to configure Solidhunter for the whole project.

This file has the following format:

{
  "name": "solidhunter",
  "rules": [
    {
      "id": "line-max-len",
      "severity": 2,
      "data": [
        "80"
      ]
    },
    {
      "id": "code-complexity",
      "severity": 2,
      "data": [
        "7"
      ]
    },
    {
      "id": "quotes",
      "severity": 1,
      "data": []
    }
  ]
}

A full list of all supported rules can be found here.

You can disable a rule by simply removing the entry in the file.

IDE Integrations

Dependencies

~4–16MB
~171K SLoC