{"id":13421664,"url":"https://github.com/protofire/solhint","last_synced_at":"2025-05-14T12:07:33.646Z","repository":{"id":37458121,"uuid":"107120334","full_name":"protofire/solhint","owner":"protofire","description":"Solhint is an open-source project to provide a linting utility for Solidity code.","archived":false,"fork":false,"pushed_at":"2024-08-20T19:40:45.000Z","size":3233,"stargazers_count":1037,"open_issues_count":29,"forks_count":160,"subscribers_count":21,"default_branch":"develop","last_synced_at":"2024-10-29T15:11:37.151Z","etag":null,"topics":["ast","code-quality","dapp","developer-tools","ethereum","linter","security-scanner","smart-contracts","solhint","solidity"],"latest_commit_sha":null,"homepage":"https://protofire.github.io/solhint/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/protofire.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-16T11:48:44.000Z","updated_at":"2024-10-23T00:46:09.000Z","dependencies_parsed_at":"2022-07-14T09:22:19.178Z","dependency_job_id":"e9d297d6-9b2f-4b05-bf5c-709d7bcda54a","html_url":"https://github.com/protofire/solhint","commit_stats":{"total_commits":801,"total_committers":49,"mean_commits":"16.346938775510203","dds":0.6204744069912609,"last_synced_commit":"0b016daf32086e66b1af71255ebcd56b5de62bdf"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fsolhint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fsolhint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fsolhint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fsolhint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/protofire","download_url":"https://codeload.github.com/protofire/solhint/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247962605,"owners_count":21024871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","code-quality","dapp","developer-tools","ethereum","linter","security-scanner","smart-contracts","solhint","solidity"],"created_at":"2024-07-30T23:00:27.855Z","updated_at":"2025-05-14T12:07:33.635Z","avatar_url":"https://github.com/protofire.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://protofire.io/solhint\" target=\"_blank\"\u003e\u003cimg src=\"solhint.png\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  By \u003ca href=\"https://protofire.io/\" target=\"_blank\"\u003eProtofire\u003c/a\u003e\n\u003c/p\u003e\n\n[![](https://img.shields.io/badge/Solhint%20Website-cyan)](https://protofire.io/solhint)\n[![](https://img.shields.io/badge/Join%20Our%20Discord-magenta)](https://discord.gg/4TYGq3zpjs)\n[![Donate with Ethereum](https://img.shields.io/badge/Donate-ETH-blue)](https://etherscan.io/address/0xA81705c8C247C413a19A244938ae7f4A0393944e)\n[![NPM version](https://badge.fury.io/js/solhint.svg)](https://npmjs.org/package/solhint)\n[![Coverage Status](https://coveralls.io/repos/github/protofire/solhint/badge.svg?branch=master)](\nhttps://coveralls.io/github/protofire/solhint?branch=master)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/protofire/solhint/master/LICENSE)\n\nThis is an open source project for linting [Solidity](http://solidity.readthedocs.io/en/develop/) code. This project\nprovides both **Security** and **Style Guide** validations.\n\u003cbr\u003e\n[VISIT OUR WEBSITE](https://protofire.io/solhint)\u003cbr\u003e\n[JOIN OUR DISCORD SERVER](https://discord.gg/4TYGq3zpjs)\n\u003cbr\u003e\n## Installation\n\nYou can install Solhint using **npm**:\n\n```sh\nnpm install -g solhint\n\n# verify that it was installed correctly\nsolhint --version\n```\n\n## Usage\n\nFirst initialize a configuration file, if you don't have one:\n\n```sh\nsolhint --init\n```\n\nThis will create a `.solhint.json` file with the recommended rules enabled. Then run Solhint with one or more [Globs](https://en.wikipedia.org/wiki/Glob_(programming)) as arguments. For example, to lint all files inside `contracts` directory, you can do:\n\n```sh\nsolhint 'contracts/**/*.sol'\n```\n\nTo lint a single file:\n\n```sh\nsolhint contracts/MyToken.sol\n```\n\nRun `solhint` without arguments to get more information:\n\n```text\nUsage: solhint [options] \u003cfile\u003e [...other_files]\n\nLinter for Solidity programming language\n\nOptions:\n\n  -V, --version                           output the version number\n  -f, --formatter [name]                  report formatter name (stylish, table, tap, unix, json, compact, sarif)\n  -w, --max-warnings [maxWarningsNumber]  number of allowed warnings, works in quiet mode as well\n  -c, --config [file_name]                file to use as your .solhint.json\n  -q, --quiet                             report errors only - default: false\n  --ignore-path [file_name]               file to use as your .solhintignore\n  --fix                                   automatically fix problems and show report\n  --noPrompt                              do not suggest to backup files when any `fix` option is selected\n  --init                                  create configuration file for solhint\n  --disc                                  do not check for solhint updates\n  --save                                  save report to file on current folder\n  -h, --help                              output usage information\n\nCommands:\n\n  stdin [options]                         linting of source code data provided to STDIN\n  list-rules                              display covered rules of current .solhint.json\n```\n### Notes\n- Solhint checks if there are newer versions. The `--disc`  option avoids that check.\n- `--save` option will create a file named as `YYYYMMDDHHMMSS_solhintReport.txt` on current folder with default or specified format \n\n### Fix\nThis option currently works on:\n- avoid-throw\n- avoid-sha3\n- no-console\n- explicit-types\n- private-vars-underscore\n- payable-fallback\n- quotes\n- contract-name-capwords\n- avoid-suicide\n  \n\u003cbr\u003e\u003cbr\u003e\n## Configuration\n\nYou can use a `.solhint.json` file to configure Solhint for the whole project.\n\nTo generate a new  sample `.solhint.json` file in current folder you can do:\n\n```sh\nsolhint --init \n```\n\nThis file has the following format:\n### Default \n```json\n{\n  \"extends\": \"solhint:recommended\"\n}\n```\n### Note\nThe `solhint:default` configuration contains only two rules: max-line-length \u0026 no-console\nIt is now deprecated since version 5.1.0\n\u003cbr\u003e\u003cbr\u003e\n\n\n### Sample\n```json\n  {\n    \"extends\": \"solhint:recommended\",\n    \"plugins\": [],\n    \"rules\": {\n      \"avoid-suicide\": \"error\",\n      \"avoid-sha3\": \"warn\"\n    }\n  }\n```\nA full list of all supported rules can be found [here](docs/rules.md).\n\nTo ignore files that do not require validation you can use a `.solhintignore` file. It supports rules in\nthe `.gitignore` format.\n\n```\nnode_modules/\nadditional-tests.sol\n```\n\n### Extendable rulesets\n\nThe rulesets provided by solhint are the following:\n\n+ solhint:default (deprecated since version v5.1.0)\n+ solhint:recommended\n\nUse one of these as the value for the \"extends\" property in your configuration file.\n\n### Configure the linter with comments\n\nYou can use comments in the source code to configure solhint in a given line or file.\n\nFor example, to disable all validations in the line following a comment:\n\n```solidity\n  // solhint-disable-next-line\n  uint[] a;\n```\n\nYou can disable specific rules on a given line. For example:\n\n```solidity\n  // solhint-disable-next-line not-rely-on-time, not-rely-on-block-hash\n  uint pseudoRand = uint(keccak256(abi.encodePacked(now, blockhash(block.number))));\n```\n\nDisable validation on current line:\n\n```solidity\n  uint pseudoRand = uint(keccak256(abi.encodePacked(now, blockhash(block.number)))); // solhint-disable-line\n```\n\nDisable specific rules on current line:\n\n```solidity\n   uint pseudoRand = uint(keccak256(abi.encodePacked(now, blockhash(block.number)))); // solhint-disable-line not-rely-on-time, not-rely-on-block-hash\n```\n\nYou can disable a rule for a group of lines:\n\n```solidity\n  /* solhint-disable avoid-tx-origin */\n  function transferTo(address to, uint amount) public {\n    require(tx.origin == owner);\n    to.call.value(amount)();\n  }\n  /* solhint-enable avoid-tx-origin */\n```\n\nOr disable all validations for a group of lines:\n\n```solidity\n  /* solhint-disable */\n  function transferTo(address to, uint amount) public {\n    require(tx.origin == owner);\n    to.call.value(amount)();\n  }\n  /* solhint-enable */\n```\n\n## Rules\n### Security Rules\n[Full list with all supported Security Rules](docs/rules.md#security-rules)\n### Style Guide Rules\n[Full list with all supported Style Guide Rules](docs/rules.md#style-guide-rules)\n### Best Practices Rules\n[Full list with all supported Best Practices Rules](docs/rules.md#best-practices-rules)\n\n## Docker\n### Solhint has an official Docker Image\nGo to docker folder and follow [this](docker/docker.md) instructions.\n\n## pre-commit\n### Solhint can also be used as [pre-commit](https://pre-commit.com/) hook\n\nReplace `$GIT_TAG` with real tag:\n\n```YAML\n- repo: https://github.com/protofire/solhint\n  rev: $GIT_TAG\n  hooks:\n    - id: solhint\n```\n\n## Documentation\nRelated documentation you may find [here](https://protofire.github.io/solhint/).\n\n## IDE Integrations\n\n  - **[Sublime Text 3](https://packagecontrol.io/search/solhint)**\n  - **[Atom](https://atom.io/packages/atom-solidity-linter)**\n  - **[Vim](https://github.com/sohkai/syntastic-local-solhint)**\n  - **[JetBrains IDEA, WebStorm, CLion, etc.](https://plugins.jetbrains.com/plugin/10177-solidity-solhint)**\n  - **[VS Code: Solidity by Juan Blanco](\n         https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity)**\n  - **[VS Code: Solidity Language Support by CodeChain.io](\n         https://marketplace.visualstudio.com/items?itemName=kodebox.solidity-language-server)**\n\n## Table of Contents\n\n* [Contributing](docs/contributing.md): The core Solhint team :heart: contributions. This describes how you can contribute to the Solhint Project.\n* [Shareable configs](docs/shareable-configs.md): How to create and share your own configurations.\n* [Writing plugins](docs/writing-plugins.md): How to extend Solhint with your own rules.\n\n## Plugins\n\n- [solhint-plugin-prettier](https://github.com/fvictorio/solhint-plugin-prettier): Integrate Solhint\n  with the [Solidity plugin for Prettier](https://github.com/prettier-solidity/prettier-plugin-solidity).\n\n## Who uses Solhint?\n[\u003cimg src=\"https://avatars0.githubusercontent.com/u/20820676?s=200\u0026v=4\" width=\"75px\" height=\"75px\" alt=\"OpenZeppelin\" title=\"OpenZeppelin\" style=\"margin: 20px 20px 0 0\" /\u003e](https://github.com/OpenZeppelin)\n[\u003cimg src=\"https://avatars2.githubusercontent.com/u/28943015?s=200\u0026v=4\" width=\"75px\" height=\"75px\" alt=\"POA Network - Public EVM Sidechain\" title=\"POA Network - Public EVM Sidechain\" style=\"margin: 20px 20px 0 0\" /\u003e](https://github.com/poanetwork) [\u003cimg src=\"https://avatars3.githubusercontent.com/u/24832717?s=200\u0026v=4\" width=\"75px\" height=\"75px\" alt=\"0x\" title=\"0x\" style=\"margin: 20px 20px 0 0\" /\u003e](https://github.com/0xProject) [\u003cimg src=\"https://avatars1.githubusercontent.com/u/24954468?s=200\u0026v=4\" width=\"75px\" height=\"75px\" alt=\"GNOSIS\" title=\"GNOSIS\" style=\"margin: 20px 20px 0 0\"/\u003e](https://github.com/gnosis)\n\n### Projects\n\n- OpenZeppelin:\n  - [openzeppelin-contracts](https://github.com/OpenZeppelin/openzeppelin-contracts)\n- POA Network - Public EVM Sidechain:\n  - [Proof of Physical Address (PoPA)](https://github.com/poanetwork/poa-popa)\n  - [Proof of Bank Account (PoBA)](https://github.com/poanetwork/poa-poba)\n- 0x-Project\n  - [0x-Monorepo](https://github.com/0xProject/0x-monorepo/tree/development/contracts)\n- Gnosis:\n  - [Gnosis Prediction Market Contracts](https://github.com/gnosis/pm-contracts)\n  - [The DutchX decentralized trading protocol](https://github.com/gnosis/dex-contracts)\n\n## Acknowledgements\n\nThe Solidity parser used is [`@solidity-parser/parser`](https://github.com/solidity-parser/parser).\n\n## License\n\nMIT\n\n## Back us\nSolhint 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 :)\n\n[![Donate with Ethereum](https://img.shields.io/badge/Donate-ETH-blue)](https://etherscan.io/address/0xA81705c8C247C413a19A244938ae7f4A0393944e)\n\n## Related projects\n\n- [eth-cli](https://github.com/protofire/eth-cli): CLI swiss army knife for Ethereum developers.\n","funding_links":[],"categories":["Tools","Software Development","JavaScript","Roadmap","Solidity","📖 Contents","Web 3.0","八、开发工具（提效必备）","Security Analysis Tools"],"sub_categories":["Linters","Code Quality","Other dialects and variants","Security Analysis Tools for SC","Testing tools","2. 代码质量工具"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotofire%2Fsolhint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprotofire%2Fsolhint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotofire%2Fsolhint/lists"}