solhint

visibility-modifier-order

Recommended Badge Category Badge Default Severity Badge warn

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

Description

Visibility modifier must be first in list of modifiers.

Options

This rule accepts a string option of rule severity. Must be one of “error”, “warn”, “off”. Default to warn.

Example Config

{
  "rules": {
    "visibility-modifier-order": "warn"
  }
}

Examples

👍 Examples of correct code for this rule

Visibility modifier placed first


      pragma solidity 0.4.4;
        
        
      contract A {
        function a() public ownable() payable {}
      }
    

👎 Examples of incorrect code for this rule

Visibility modifier not placed first


      pragma solidity 0.4.4;
        
        
      contract A {
        function a() ownable() public payable {}
      }
    

Version

This rule was introduced in Solhint 1.1.5

Resources