4 min read - Posted 05 Jun 19

Lint your Solidity contracts with Solhint

Solhint is an open source project for linting Solidity code. This project provides both Security and Style Guide validations.


You can install Solhint using npm:

npm install -g solhint

# verify that it was installed correctly
solhint -V


For linting Solidity files you need to run Solhint with one or more Globs) as arguments. For example, to lint all files inside contracts directory, you can do:

solhint "contracts/**/*.sol"

To lint a single file:

solhint contracts/MyToken.sol

Solhint command description:

Usage: solhint [options] <file> [...other_files]

Linter for Solidity programming language


  -V, --version                              output the version number
  -f, --formatter [name]                     report formatter name (stylish, table, tap, unix)
  -w, --max-warnings [maxWarningsNumber]     number of warnings to trigger nonzero
  -c, --config [file_name]                   file to use as your .solhint.json
  -q, --quiet                                report errors only - default: false
  --ignore-path [file_name]                  file to use as your .solhintignore
  -h, --help                                 output usage information


  stdin [options]         put source code to stdin of this utility
  init-config             create sample solhint config in current folder


You use a .solhint.json file to configure Solhint globally. This file has the following format:

    "extends": "solhint:default",
    "plugins": [],
    "rules": {
      "avoid-throw": false,
      "avoid-suicide": "error",
      "avoid-sha3": "warn"

To ignore files / folders that do not require validation you may use .solhintignore file. It supports rules in .gitignore format.

Configure linter with comments

You can use comments in the source code to configure solhint in a given line or file.

For example, to disable all validations in the line following a comment:

  // solhint-disable-next-line
  uint[] a;

You can disable a single rule on a given line. For example, to disable validation of fixed compiler version in the next line:

  // solhint-disable-next-line compiler-fixed, compiler-gt-0_4
  pragma solidity ^0.4.4;

Disable validation on current line:

  pragma solidity ^0.4.4; // solhint-disable-line

Disable validation of fixed compiler version validation on current line:

  pragma solidity ^0.4.4; // solhint-disable-line compiler-fixed, compiler-gt-0_4

You can disable a rule for a group of lines:

  /* solhint-disable avoid-throw */
  if (a > 1) {
  /* solhint-enable avoid-throw */

Or disable all validations for a group of lines:

  /* solhint-disable */
  if (a > 1) {
  /* solhint-enable */


Security Rules

Full list with all supported Security Rules ### Style Guide Rules Full list with all supported Style Guide Rules ### Best Practices Rules Full list with all supported Best Practices Rules

More details

  • Read the full Solhint documentation.
  • Roadmap: The core project's roadmap - what the core team is looking to work on in the near future.
  • Contributing: The core Solhint team :heart: contributions. This describes how you can contribute to the Solhint Project.
  • Shareable configs: How to create and share your own configurations.
  • Writing plugins: How to extend Solhint with your own rules.

IDE Integrations

Created with Sketch.Content is"CC-BY-SA 4.0" licensed
Article On-chain
Article Author

Kauri Team




Related Articles
Lint your Solidity contracts with Ethlint

Ethlint (Formerly Solium) analyzes your Solidity code for style & security issues and fixes them. Installnpm install -g ethlint solium -V For backward-compatibility, you can still use npm install -g solium. If youre currently using the solium package for npm install, it is highly recommended that you move to ethlint. The solium package will not receive updates after December, 2019. There are no differences between the updates pushed to ethlint and solium packages. Usage In the root directory of

Kauri Team

28 May 19

Analyze Solidity Smart Contracts with Slither

Slither is a Solidity static analysis framework written in Python 3. It runs a suite of vulnerability detectors, prints visual information about contract details, and provides an API to easily write custom analyses. Slither enables developers to find vulnerabilities, enhance their code comprehension, and quickly prototype custom analyses. Features Detects vulnerable Solidity code with low false positives Identifies where the error condition occurs in the source code Easily integrates into contin

Kauri Team

28 May 19