All Projects → protofire → Solhint

protofire / Solhint

Licence: mit
Solhint is an open source project created by https://protofire.io. Its goal is to provide a linting utility for Solidity code.

Programming Languages

javascript
184084 projects - #8 most used programming language
solidity
1140 projects

Projects that are alternatives of or similar to Solhint

Augmint Web
Augmint Web Frontend
Stars: ✭ 15 (-95.87%)
Mutual labels:  ethereum, smart-contracts, dapp
Embark
Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms
Stars: ✭ 3,478 (+858.13%)
Mutual labels:  ethereum, smart-contracts, dapp
Ethereumbook
Mastering Ethereum, by Andreas M. Antonopoulos, Gavin Wood
Stars: ✭ 11,663 (+3112.95%)
Mutual labels:  ethereum, smart-contracts, dapp
Buidl
A browser-based IDE for creating, deploying, and sharing blockchain apps (DApps, or decentralized apps). Publish your first blockchain DApps in 5 minutes! Here is how: https://docs.secondstate.io/buidl-developer-tool/getting-started
Stars: ✭ 376 (+3.58%)
Mutual labels:  ethereum, smart-contracts, dapp
Erc20 Generator
Create an ERC20 Token for FREE in less than a minute with the most used Smart Contract Generator for ERC20 Token. No login. No setup. No coding required.
Stars: ✭ 202 (-44.35%)
Mutual labels:  ethereum, smart-contracts, dapp
Eth.social
An Ethereum dApp for posting social events.
Stars: ✭ 17 (-95.32%)
Mutual labels:  ethereum, smart-contracts, dapp
Tenderly Cli
CLI tool for Smart Contract error tracking, monitoring and alerting.
Stars: ✭ 138 (-61.98%)
Mutual labels:  ethereum, smart-contracts, developer-tools
Eth Crypto
Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
Stars: ✭ 420 (+15.7%)
Mutual labels:  ethereum, smart-contracts, dapp
Love Ethereum
区块链学习
Stars: ✭ 323 (-11.02%)
Mutual labels:  ethereum, smart-contracts, dapp
Dasp
The Decentralized Application Security Project
Stars: ✭ 166 (-54.27%)
Mutual labels:  ethereum, smart-contracts, dapp
Awesome Solidity
A curated list of awesome Solidity resources
Stars: ✭ 111 (-69.42%)
Mutual labels:  ethereum, smart-contracts, dapp
Awesome Buggy Erc20 Tokens
A Collection of Vulnerabilities in ERC20 Smart Contracts With Tokens Affected
Stars: ✭ 251 (-30.85%)
Mutual labels:  ethereum, smart-contracts, dapp
Eth95
🛠️ A smart contract UI for your Ethereum dapp project
Stars: ✭ 139 (-61.71%)
Mutual labels:  ethereum, smart-contracts, dapp
Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions.
Stars: ✭ 237 (-34.71%)
Mutual labels:  ethereum, smart-contracts, dapp
Celo Monorepo
Official repository for core projects comprising the Celo platform
Stars: ✭ 269 (-25.9%)
Mutual labels:  ethereum, smart-contracts, dapp
Detekt
Static code analysis for Kotlin
Stars: ✭ 4,169 (+1048.48%)
Mutual labels:  linter, code-quality
Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (+1150.96%)
Mutual labels:  linter, code-quality
Git Cop
DEPRECATED: Use Git Lint (https://www.alchemists.io/projects/git-lint) instead.
Stars: ✭ 352 (-3.03%)
Mutual labels:  linter, code-quality
Colonynetwork
Colony Network smart contracts
Stars: ✭ 351 (-3.31%)
Mutual labels:  ethereum, smart-contracts
Web3.swift
A pure swift Ethereum Web3 library
Stars: ✭ 295 (-18.73%)
Mutual labels:  ethereum, smart-contracts

By Protofire

Donate with Ethereum

Gitter chat Build Status NPM version Coverage Status MIT licensed dependencies Status devDependencies Status

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

Installation

You can install Solhint using npm:

npm install -g solhint

# verify that it was installed correctly
solhint --version

Usage

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

solhint --init

This will create a .solhint.json file with the default rules enabled. Then 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

Run solhint without arguments to get more information:

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

Linter for Solidity programming language

Options:

  -V, --version                           output the version number
  -f, --formatter [name]                  report formatter name (stylish, table, tap, unix)
  -w, --max-warnings [maxWarningsNumber]  number of allowed warnings
  -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
  --fix                                   automatically fix problems
  --init                                  create configuration file for solhint
  -h, --help                              output usage information

Commands:

  stdin [options]                         linting of source code data provided to STDIN

Configuration

You can use a .solhint.json file to configure Solhint for the whole project.

To generate a new sample .solhint.json file in current folder you can do:

solhint --init 

This file has the following format:

  {
    "extends": "solhint:recommended",
    "plugins": [],
    "rules": {
      "avoid-suicide": "error",
      "avoid-sha3": "warn"
    }
  }

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

To ignore files that do not require validation you can use a .solhintignore file. It supports rules in the .gitignore format.

node_modules/
additional-tests.sol

Extendable rulesets

The default rulesets provided by solhint are the following:

  • solhint:default
  • solhint:recommended

Use one of these as the value for the "extends" property in your configuration file.

Configure the 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 specific rules on a given line. For example:

  // solhint-disable-next-line not-rely-on-time, not-rely-on-block-hash
  uint pseudoRand = uint(keccak256(abi.encodePacked(now, blockhash(block.number))));

Disable validation on current line:

  uint pseudoRand = uint(keccak256(abi.encodePacked(now, blockhash(block.number)))); // solhint-disable-line

Disable specific rules on current line:

   uint pseudoRand = uint(keccak256(abi.encodePacked(now, blockhash(block.number)))); // solhint-disable-line not-rely-on-time, not-rely-on-block-hash

You can disable a rule for a group of lines:

  /* solhint-disable avoid-tx-origin */
  function transferTo(address to, uint amount) public {
    require(tx.origin == owner);
    to.call.value(amount)();
  }
  /* solhint-enable avoid-tx-origin */

Or disable all validations for a group of lines:

  /* solhint-disable */
  function transferTo(address to, uint amount) public {
    require(tx.origin == owner);
    to.call.value(amount)();
  }
  /* solhint-enable */

Rules

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

Documentation

Related documentation you may find here.

IDE Integrations

Table of Contents

  • Roadmap: The core project's roadmap - what the core team is looking to work on in the near future.
  • Contributing: The core Solhint team ❤️ 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.

Plugins

Who uses Solhint?

OpenZeppelin POA Network - Public EVM Sidechain 0x GNOSIS

Projects

Acknowledgements

The Solidity parser used is @solidity-parser/parser.

Licence

MIT

Back us

Solhint is free to use and open-sourced. If you value our effort and feel like helping us to keep pushing this tool forward, you can send us a small donation. We'll highly appreciate it :)

Donate with Ethereum

Related projects

  • eth-cli: CLI swiss army knife for Ethereum developers.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].