Socket
Socket
Sign inDemoInstall

solhint

Package Overview
Dependencies
Maintainers
4
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solhint - npm Package Compare versions

Comparing version 3.0.0-rc.8 to 3.0.0

docs/rules/naming/private-vars-leading-underscore.md

90

docs/architecture.md

@@ -17,22 +17,15 @@ ---

The file structure below describes the major structure of the project.
The file structure below describes the most important files and directories of the project.
```
├── conf/rulesets # solhint official configs
├── docs # documentation
├── lib # main source code
│   ├── comment-directive-parser.js # comment parsers
│   ├── common # utility modules for syntax parsing, reporting, etc.
│   ├── config # helpers for loading solhint configuration
│   ├── config.js # load config
│   ├── doc # documentation utilities
│   ├── grammar # solidity grammar, generated with ANTLR
│   ├── index.js # main entry point
│   ├── load-rules.js # module for loading rules
│   ├── reporter.js # module for reporting results
│   ├── rules # source for solhint rules
│   └── tree-listener.js # used for register all loaded rules
├── scripts # script for generating grammar and rule docs
├── solhint.js # solhint command line
├── solidity-antlr4 # git submodule for solidity-antlr4
└── test # tests
├── lib
│   ├── common # utility modules
│   ├── config # configuration loading
│   ├── rules # core rules
│   └── index.js # lib entry point
├── scripts # scripts for automating tasks
├── test # unit tests
└── solhint.js # bin entry point
```

@@ -48,67 +41,4 @@

For example, `lib/rules/align/indent.js`:
```javascript
const ruleId = 'indent'
const DEFAULT_SEVERITY = 'error'
const DEFAULT_INDENTS = 4
const meta = {
type: 'align',
docs: {
// ...
},
isDefault: true,
recommended: true,
defaultSetup: [DEFAULT_SEVERITY, DEFAULT_INDENTS],
schema: {
type: 'integer'
}
}
class IndentChecker {
constructor(reporter, config) {
this.reporter = reporter
this.ruleId = ruleId
this.meta = meta
this.linesWithError = []
const indent = this.parseConfig(config).indent || 4
const indentUnit = this.parseConfig(config).unit || 'spaces'
this.blockValidator = new BlockValidator(indent, indentUnit, reporter, this.ruleId)
// ...
}
enterBlock(ctx) {
this.blockValidator.validateBlock(ctx)
}
enterContractDefinition(ctx) {
this.blockValidator.validateBlock(ctx)
}
enterStructDefinition(ctx) {
this.blockValidator.validateBlock(ctx)
}
enterEnumDefinition(ctx) {
this.blockValidator.validateBlock(ctx)
}
enterImportDirective(ctx) {
this.blockValidator.validateBlock(ctx)
}
```
Developers of new rules need to have a basic understanding about the concepts and structure of the AST, and execute the proper logic when certain nodes in the AST are visited.
You can see a list of the available AST nodes in the [solidity-antlr4](https://github.com/solidityj/solidity-antlr4/blob/master/Solidity.g4) project.
### How to Add a Plugin

@@ -115,0 +45,0 @@

@@ -5,34 +5,6 @@ ---

title: "Rule Index of Solhint"
date: "Wed, 19 Feb 2020 23:51:57 GMT"
date: "Fri, 01 May 2020 22:04:11 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"
---
## Style Guide Rules
| Rule Id | Error | Recommended |
| ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ----------- |
| [array-declaration-spaces](./rules/align/array-declaration-spaces.md) | Array declaration must not contains spaces. | ✔️ |
| [bracket-align](./rules/align/bracket-align.md) | Open bracket must be on same line. It must be indented by other constructions by space. | ✔️ |
| [expression-indent](./rules/align/expression-indent.md) | Expression indentation is incorrect. | ✔️ |
| [indent](./rules/align/indent.md) | Indentation is incorrect. | ✔️ |
| [no-mix-tabs-and-spaces](./rules/align/no-mix-tabs-and-spaces.md) | Mixed tabs and spaces. | ✔️ |
| [no-spaces-before-semicolon](./rules/align/no-spaces-before-semicolon.md) | Semicolon must not have spaces before. | ✔️ |
| [space-after-comma](./rules/align/space-after-comma.md) | Comma must be separated from next element by space. | ✔️ |
| [statement-indent](./rules/align/statement-indent.md) | Statement indentation is incorrect. | ✔️ |
| [quotes](./rules/miscellaneous/quotes.md) | Use double quotes for string literals. Values must be 'single' or 'double'. | ✔️ |
| [const-name-snakecase](./rules/naming/const-name-snakecase.md) | Constant name must be in capitalized SNAKE_CASE. | ✔️ |
| [contract-name-camelcase](./rules/naming/contract-name-camelcase.md) | Contract name must be in CamelCase. | ✔️ |
| [event-name-camelcase](./rules/naming/event-name-camelcase.md) | Event name must be in CamelCase. | ✔️ |
| [func-name-mixedcase](./rules/naming/func-name-mixedcase.md) | Function name must be in camelCase. | ✔️ |
| [func-param-name-mixedcase](./rules/naming/func-param-name-mixedcase.md) | Function name must be in camelCase. | |
| [modifier-name-mixedcase](./rules/naming/modifier-name-mixedcase.md) | Modifier name must be in mixedCase. | |
| [use-forbidden-name](./rules/naming/use-forbidden-name.md) | Avoid to use letters 'I', 'l', 'O' as identifiers. | ✔️ |
| [var-name-mixedcase](./rules/naming/var-name-mixedcase.md) | Variable name must be in mixedCase. | ✔️ |
| [func-order](./rules/order/func-order.md) | Function order is incorrect. | |
| [imports-on-top](./rules/order/imports-on-top.md) | Import statements must be on top. | ✔️ |
| [separate-by-one-line-in-contract](./rules/order/separate-by-one-line-in-contract.md) | Definitions inside contract / library must be separated by one line. | |
| [two-lines-top-level-separator](./rules/order/two-lines-top-level-separator.md) | Definition must be surrounded with two blank line indent. | |
| [visibility-modifier-order](./rules/order/visibility-modifier-order.md) | Visibility modifier must be first in list of modifiers. | ✔️ |
## Best Practise Rules

@@ -53,26 +25,42 @@

## Style Guide Rules
| Rule Id | Error | Recommended |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------- | ----------- |
| [quotes](./rules/miscellaneous/quotes.md) | Use double quotes for string literals. Values must be 'single' or 'double'. | ✔️ |
| [const-name-snakecase](./rules/naming/const-name-snakecase.md) | Constant name must be in capitalized SNAKE_CASE. | ✔️ |
| [contract-name-camelcase](./rules/naming/contract-name-camelcase.md) | Contract name must be in CamelCase. | ✔️ |
| [event-name-camelcase](./rules/naming/event-name-camelcase.md) | Event name must be in CamelCase. | ✔️ |
| [func-name-mixedcase](./rules/naming/func-name-mixedcase.md) | Function name must be in camelCase. | ✔️ |
| [func-param-name-mixedcase](./rules/naming/func-param-name-mixedcase.md) | Function param name must be in mixedCase | |
| [modifier-name-mixedcase](./rules/naming/modifier-name-mixedcase.md) | Modifier name must be in mixedCase. | |
| [private-vars-leading-underscore](./rules/naming/private-vars-leading-underscore.md) | Private and internal names must start with a single underscore. | |
| [use-forbidden-name](./rules/naming/use-forbidden-name.md) | Avoid to use letters 'I', 'l', 'O' as identifiers. | ✔️ |
| [var-name-mixedcase](./rules/naming/var-name-mixedcase.md) | Variable name must be in mixedCase. | ✔️ |
| [func-order](./rules/order/func-order.md) | Function order is incorrect. | |
| [imports-on-top](./rules/order/imports-on-top.md) | Import statements must be on top. | ✔️ |
| [visibility-modifier-order](./rules/order/visibility-modifier-order.md) | Visibility modifier must be first in list of modifiers. | ✔️ |
## Security Rules
| Rule Id | Error | Recommended |
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ----------- |
| [avoid-call-value](./rules/security/avoid-call-value.md) | Avoid to use ".call.value()()". | ✔️ |
| [avoid-low-level-calls](./rules/security/avoid-low-level-calls.md) | Avoid to use low level calls. | ✔️ |
| [avoid-sha3](./rules/security/avoid-sha3.md) | Use "keccak256" instead of deprecated "sha3". | ✔️ |
| [avoid-suicide](./rules/security/avoid-suicide.md) | Use "selfdestruct" instead of deprecated "suicide". | ✔️ |
| [avoid-throw](./rules/security/avoid-throw.md) | "throw" is deprecated, avoid to use it. | ✔️ |
| [avoid-tx-origin](./rules/security/avoid-tx-origin.md) | Avoid to use tx.origin. | ✔️ |
| [check-send-result](./rules/security/check-send-result.md) | Check result of "send" call. | ✔️ |
| [compiler-fixed](./rules/security/compiler-fixed.md) | Compiler version must be fixed. | |
| [compiler-gt-0_4](./rules/security/compiler-gt-0_4.md) | Compiler version must be fixed. | |
| [compiler-version](./rules/security/compiler-version.md) | Compiler version must satisfy a semver requirement. | ✔️ |
| [func-visibility](./rules/security/func-visibility.md) | Explicitly mark visibility in function. | ✔️ |
| [mark-callable-contracts](./rules/security/mark-callable-contracts.md) | Explicitly mark all external contracts as trusted or untrusted. | ✔️ |
| [multiple-sends](./rules/security/multiple-sends.md) | Avoid multiple calls of "send" method in single transaction. | ✔️ |
| [no-complex-fallback](./rules/security/no-complex-fallback.md) | Fallback function must be simple. | ✔️ |
| [no-inline-assembly](./rules/security/no-inline-assembly.md) | Avoid to use inline assembly. It is acceptable only in rare cases. | ✔️ |
| [no-simple-event-func-name](./rules/security/no-simple-event-func-name.md) | Event and function names must be different. | |
| [not-rely-on-block-hash](./rules/security/not-rely-on-block-hash.md) | Do not rely on "block.blockhash". Miners can influence its value. | ✔️ |
| [not-rely-on-time](./rules/security/not-rely-on-time.md) | Avoid to make time-based decisions in your business logic. | ✔️ |
| [reentrancy](./rules/security/reentrancy.md) | Possible reentrancy vulnerabilities. Avoid state changes after transfer. | ✔️ |
| [state-visibility](./rules/security/state-visibility.md) | Explicitly mark visibility of state. | ✔️ |
| Rule Id | Error | Recommended |
| ---------------------------------------------------------------------- | ------------------------------------------------------------------------ | ----------- |
| [avoid-call-value](./rules/security/avoid-call-value.md) | Avoid to use ".call.value()()". | ✔️ |
| [avoid-low-level-calls](./rules/security/avoid-low-level-calls.md) | Avoid to use low level calls. | ✔️ |
| [avoid-sha3](./rules/security/avoid-sha3.md) | Use "keccak256" instead of deprecated "sha3". | ✔️ |
| [avoid-suicide](./rules/security/avoid-suicide.md) | Use "selfdestruct" instead of deprecated "suicide". | ✔️ |
| [avoid-throw](./rules/security/avoid-throw.md) | "throw" is deprecated, avoid to use it. | ✔️ |
| [avoid-tx-origin](./rules/security/avoid-tx-origin.md) | Avoid to use tx.origin. | ✔️ |
| [check-send-result](./rules/security/check-send-result.md) | Check result of "send" call. | ✔️ |
| [compiler-version](./rules/security/compiler-version.md) | Compiler version must satisfy a semver requirement. | ✔️ |
| [func-visibility](./rules/security/func-visibility.md) | Explicitly mark visibility in function. | ✔️ |
| [mark-callable-contracts](./rules/security/mark-callable-contracts.md) | Explicitly mark all external contracts as trusted or untrusted. | |
| [multiple-sends](./rules/security/multiple-sends.md) | Avoid multiple calls of "send" method in single transaction. | ✔️ |
| [no-complex-fallback](./rules/security/no-complex-fallback.md) | Fallback function must be simple. | ✔️ |
| [no-inline-assembly](./rules/security/no-inline-assembly.md) | Avoid to use inline assembly. It is acceptable only in rare cases. | ✔️ |
| [not-rely-on-block-hash](./rules/security/not-rely-on-block-hash.md) | Do not rely on "block.blockhash". Miners can influence its value. | ✔️ |
| [not-rely-on-time](./rules/security/not-rely-on-time.md) | Avoid to make time-based decisions in your business logic. | ✔️ |
| [reentrancy](./rules/security/reentrancy.md) | Possible reentrancy vulnerabilities. Avoid state changes after transfer. | ✔️ |
| [state-visibility](./rules/security/state-visibility.md) | Explicitly mark visibility of state. | ✔️ |

@@ -79,0 +67,0 @@

@@ -5,3 +5,3 @@ ---

title: "code-complexity | Solhint"
date: "Wed, 19 Feb 2020 23:51:46 GMT"
date: "Thu, 23 Apr 2020 20:59:47 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "constructor-syntax | Solhint"
date: "Wed, 19 Feb 2020 23:51:48 GMT"
date: "Thu, 23 Apr 2020 20:59:48 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "function-max-lines | Solhint"
date: "Wed, 19 Feb 2020 23:51:46 GMT"
date: "Thu, 23 Apr 2020 20:59:47 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "max-line-length | Solhint"
date: "Wed, 19 Feb 2020 23:51:47 GMT"
date: "Thu, 23 Apr 2020 20:59:47 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "max-states-count | Solhint"
date: "Wed, 19 Feb 2020 23:51:47 GMT"
date: "Thu, 23 Apr 2020 20:59:48 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "no-empty-blocks | Solhint"
date: "Wed, 19 Feb 2020 23:51:47 GMT"
date: "Thu, 23 Apr 2020 20:59:48 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "no-unused-vars | Solhint"
date: "Wed, 19 Feb 2020 23:51:47 GMT"
date: "Thu, 23 Apr 2020 20:59:48 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "payable-fallback | Solhint"
date: "Wed, 19 Feb 2020 23:51:48 GMT"
date: "Thu, 23 Apr 2020 20:59:48 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "reason-string | Solhint"
date: "Wed, 19 Feb 2020 23:51:48 GMT"
date: "Thu, 23 Apr 2020 20:59:48 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -80,3 +80,3 @@ ---

## Version
This rule was introduced in [Solhint 3.0.0-rc.1](https://github.com/protofire/solhint/tree/v3.0.0-rc.1)
This rule was introduced in [Solhint 2.3.1](https://github.com/protofire/solhint/tree/v2.3.1)

@@ -83,0 +83,0 @@ ## Resources

@@ -5,3 +5,3 @@ ---

title: "quotes | Solhint"
date: "Wed, 19 Feb 2020 23:51:48 GMT"
date: "Thu, 23 Apr 2020 20:59:49 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "const-name-snakecase | Solhint"
date: "Wed, 19 Feb 2020 23:51:49 GMT"
date: "Thu, 23 Apr 2020 20:59:49 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "contract-name-camelcase | Solhint"
date: "Wed, 19 Feb 2020 23:51:49 GMT"
date: "Thu, 23 Apr 2020 20:59:49 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "event-name-camelcase | Solhint"
date: "Wed, 19 Feb 2020 23:51:49 GMT"
date: "Thu, 23 Apr 2020 20:59:49 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "func-name-mixedcase | Solhint"
date: "Wed, 19 Feb 2020 23:51:49 GMT"
date: "Thu, 23 Apr 2020 20:59:49 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "func-param-name-mixedcase | Solhint"
date: "Wed, 19 Feb 2020 23:51:50 GMT"
date: "Thu, 23 Apr 2020 20:59:49 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -15,3 +15,3 @@ ---

## Description
Function name must be in camelCase.
Function param name must be in mixedCase

@@ -18,0 +18,0 @@ ## Options

@@ -5,3 +5,3 @@ ---

title: "modifier-name-mixedcase | Solhint"
date: "Wed, 19 Feb 2020 23:51:50 GMT"
date: "Thu, 23 Apr 2020 20:59:50 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "use-forbidden-name | Solhint"
date: "Wed, 19 Feb 2020 23:51:50 GMT"
date: "Thu, 23 Apr 2020 20:59:50 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "var-name-mixedcase | Solhint"
date: "Wed, 19 Feb 2020 23:51:50 GMT"
date: "Thu, 23 Apr 2020 20:59:50 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "func-order | Solhint"
date: "Wed, 19 Feb 2020 23:51:51 GMT"
date: "Thu, 23 Apr 2020 20:59:50 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "imports-on-top | Solhint"
date: "Wed, 19 Feb 2020 23:51:51 GMT"
date: "Thu, 23 Apr 2020 20:59:51 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "visibility-modifier-order | Solhint"
date: "Wed, 19 Feb 2020 23:51:52 GMT"
date: "Thu, 23 Apr 2020 20:59:51 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "avoid-call-value | Solhint"
date: "Wed, 19 Feb 2020 23:51:52 GMT"
date: "Thu, 23 Apr 2020 20:59:51 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "avoid-low-level-calls | Solhint"
date: "Wed, 19 Feb 2020 23:51:52 GMT"
date: "Thu, 23 Apr 2020 20:59:51 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "avoid-sha3 | Solhint"
date: "Wed, 19 Feb 2020 23:51:52 GMT"
date: "Thu, 23 Apr 2020 20:59:51 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "avoid-suicide | Solhint"
date: "Wed, 19 Feb 2020 23:51:53 GMT"
date: "Thu, 23 Apr 2020 20:59:51 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "avoid-throw | Solhint"
date: "Wed, 19 Feb 2020 23:51:53 GMT"
date: "Thu, 23 Apr 2020 20:59:51 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "avoid-tx-origin | Solhint"
date: "Wed, 19 Feb 2020 23:51:53 GMT"
date: "Thu, 23 Apr 2020 20:59:52 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "check-send-result | Solhint"
date: "Wed, 19 Feb 2020 23:51:53 GMT"
date: "Thu, 23 Apr 2020 20:59:52 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "compiler-version | Solhint"
date: "Wed, 19 Feb 2020 23:51:54 GMT"
date: "Thu, 23 Apr 2020 20:59:52 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "func-visibility | Solhint"
date: "Wed, 19 Feb 2020 23:51:55 GMT"
date: "Thu, 23 Apr 2020 20:59:52 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "mark-callable-contracts | Solhint"
date: "Wed, 19 Feb 2020 23:51:55 GMT"
date: "Fri, 01 May 2020 22:04:10 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -11,8 +11,5 @@ ---

# mark-callable-contracts
![Recommended Badge](https://img.shields.io/badge/-Recommended-brightgreen)
![Category Badge](https://img.shields.io/badge/-Security%20Rules-informational)
![Default Severity Badge warn](https://img.shields.io/badge/Default%20Severity-warn-yellow)
> The {"extends": "solhint:recommended"} property in a configuration file enables this rule.
## Description

@@ -19,0 +16,0 @@ Explicitly mark all external contracts as trusted or untrusted.

@@ -5,3 +5,3 @@ ---

title: "multiple-sends | Solhint"
date: "Wed, 19 Feb 2020 23:51:55 GMT"
date: "Thu, 23 Apr 2020 20:59:53 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "no-complex-fallback | Solhint"
date: "Wed, 19 Feb 2020 23:51:55 GMT"
date: "Thu, 23 Apr 2020 20:59:53 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "no-inline-assembly | Solhint"
date: "Wed, 19 Feb 2020 23:51:56 GMT"
date: "Thu, 23 Apr 2020 20:59:53 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "not-rely-on-block-hash | Solhint"
date: "Wed, 19 Feb 2020 23:51:56 GMT"
date: "Thu, 23 Apr 2020 20:59:53 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "not-rely-on-time | Solhint"
date: "Wed, 19 Feb 2020 23:51:56 GMT"
date: "Thu, 23 Apr 2020 20:59:53 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "reentrancy | Solhint"
date: "Wed, 19 Feb 2020 23:51:57 GMT"
date: "Thu, 23 Apr 2020 20:59:53 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -5,3 +5,3 @@ ---

title: "state-visibility | Solhint"
date: "Wed, 19 Feb 2020 23:51:57 GMT"
date: "Thu, 23 Apr 2020 20:59:54 GMT"
author: "Franco Victorio <victorio.franco@gmail.com>"

@@ -8,0 +8,0 @@ ---

@@ -12,2 +12,10 @@ const chalk = require('chalk')

const notifyRuleDeprecated = _.memoize(ruleId => {
console.warn(chalk.yellow(`[solhint] Warning: rule '${ruleId}' is deprecated.`))
})
const notifyRuleDoesntExist = _.memoize(ruleId => {
console.warn(chalk.yellow(`[solhint] Warning: Rule '${ruleId}' doesn't exist`))
})
module.exports = function checkers(reporter, configVals, inputSrc, tokens, fileName) {

@@ -32,3 +40,3 @@ const config = configObject.from(configVals)

if (rule.meta && rule.meta.deprecated) {
console.warn(chalk.yellow(`[solhint] Warning: rule '${rule.ruleId}' is deprecated.`))
notifyRuleDeprecated(rule.ruleId)
}

@@ -41,3 +49,3 @@ }

if (!allRuleIds.includes(rule)) {
console.warn(chalk.yellow(`[solhint] Warning: Rule '${rule}' doesn't exist`))
notifyRuleDoesntExist(rule)
}

@@ -69,3 +77,3 @@ }

chalk.red(
`[solhint] Error: Could not load solhint-plugin-${pluginName}, make sure it's installed..`
`[solhint] Error: Could not load solhint-plugin-${pluginName}, make sure it's installed.`
)

@@ -72,0 +80,0 @@ )

@@ -31,3 +31,3 @@ const TreeTraversing = require('./../../common/tree-traversing')

isDefault: false,
recommended: true,
recommended: false,
defaultSetup: 'warn',

@@ -34,0 +34,0 @@

{
"name": "solhint",
"version": "3.0.0-rc.8",
"version": "3.0.0",
"description": "Solidity Code Linter",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -30,5 +30,13 @@ <p align="center">

# verify that it was installed correctly
solhint -V
solhint --version
```
### Solhint 3.0
Solhint 3.0 is under development and will be released soon. You can try it out by doing:
```sh
npm install -g solhint@next
```
## Usage

@@ -42,3 +50,3 @@

This will create a `.solhint.json` file with some default 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:
This will create a `.solhint.json` file with the default 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:

@@ -55,3 +63,3 @@ ```sh

Solhint command description:
Run `solhint` without arguments to get more information:

@@ -82,5 +90,6 @@ ```text

You can use a `.solhint.json` file to configure Solhint globally.
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:
```sh

@@ -106,4 +115,4 @@ solhint init-config

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

@@ -115,3 +124,3 @@ ```git exclude

### Configure linter with comments
### Configure the linter with comments

@@ -127,4 +136,3 @@ You can use comments in the source code to configure solhint in a given line or file.

You can disable rules on a given line. For example, to disable validation of time and block hash based computations
in the next line:
You can disable specific rules on a given line. For example:

@@ -142,3 +150,3 @@ ```solidity

Disable validation of time and block hash based computations on current line:
Disable specific rules on current line:

@@ -181,3 +189,3 @@ ```solidity

Related documentation you may find [there](https://protofire.github.io/solhint/).
Related documentation you may find [here](https://protofire.github.io/solhint/).

@@ -184,0 +192,0 @@ ## IDE Integrations

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc