Skip to content

Latest commit

 

History

History
85 lines (61 loc) · 2.15 KB

explicit-types.md

File metadata and controls

85 lines (61 loc) · 2.15 KB
warning layout title
This is a dynamically generated file. Do not edit manually.
default
explicit-types | Solhint

explicit-types

Recommended Badge Category Badge Default Severity Badge warn

The {"extends": "solhint:recommended"} property in a configuration file enables this rule.

Description

Forbid or enforce explicit types (like uint256) that have an alias (like uint).

Options

This rule accepts an array of options:

Index Description Default Value
0 Rule severity. Must be one of "error", "warn", "off". warn
1 Options need to be one of "explicit", "implicit" explicit

Example Config

{
  "rules": {
    "explicit-types": ["warn","explicit"]
  }
}

Notes

  • Solhint allows this rule to automatically fix the code with --fix option

Examples

👍 Examples of correct code for this rule

If explicit is selected

uint256 public variableName

If implicit is selected

uint public variableName

If explicit is selected

uint256 public variableName = uint256(5)

👎 Examples of incorrect code for this rule

If explicit is selected

uint public variableName

If implicit is selected

uint256 public variableName

At any setting

uint public variableName = uint256(5)

Version

This rule was introduced in Solhint 5.0.4

Resources