Skip to content

Latest commit

 

History

History
98 lines (71 loc) · 3.17 KB

private-vars-leading-underscore.md

File metadata and controls

98 lines (71 loc) · 3.17 KB
warning layout title
This is a dynamically generated file. Do not edit manually.
default
private-vars-leading-underscore | Solhint

private-vars-leading-underscore

Category Badge Default Severity Badge warn

Description

Non-external functions and state variables should start with a single underscore. Others, shouldn't

Options

This rule accepts an array of options:

Index Description Default Value
0 Rule severity. Must be one of "error", "warn", "off". warn
1 A JSON object with a single property "strict" specifying if the rule should apply to ALL non state variables. Default: { strict: false }. {"strict":false}

Example Config

{
  "rules": {
    "private-vars-leading-underscore": ["warn",{"strict":false}]
  }
}

Notes

  • This rule DO NOT considers functions and variables in Libraries
  • This rule skips external and public functions
  • This rule skips external and public state variables
  • See here for further information
  • Solhint allows this rule to automatically fix the code with --fix option

Examples

👍 Examples of correct code for this rule

Internal function with correct naming

function _thisIsInternal() internal {}

Private function with correct naming

function _thisIsPrivate() private {}

Internal state variable with correct naming

uint256 internal _thisIsInternalVariable;

Internal state variable with correct naming (no visibility is considered internal)

uint256 _thisIsInternalVariable;

👎 Examples of incorrect code for this rule

Internal function with incorrect naming

function thisIsInternal() internal {}

Private function with incorrect naming

function thisIsPrivate() private {}

Internal state variable with incorrect naming

uint256 internal thisIsInternalVariable;

Internal state variable with incorrect naming (no visibility is considered internal)

uint256 thisIsInternalVariable;

Version

This rule was introduced in Solhint 3.0.0-rc.3

Resources