Skip to content

Latest commit

 

History

History
107 lines (83 loc) · 2.88 KB

max-states-count.md

File metadata and controls

107 lines (83 loc) · 2.88 KB
warning layout title
This is a dynamically generated file. Do not edit manually.
default
max-states-count | Solhint

max-states-count

Recommended Badge Category Badge Default Severity Badge warn

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

Description

Contract has "some count" states declarations but allowed no more than maxstates.

Options

This rule accepts an array of options:

Index Description Default Value
0 Rule severity. Must be one of "error", "warn", "off". warn
1 Maximum allowed number of states declarations 15

Example Config

{
  "rules": {
    "max-states-count": ["warn",15]
  }
}

Examples

👍 Examples of correct code for this rule

Low number of states

      pragma solidity 0.4.4;
        
        
      contract A {
                uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private constant TEST = 1;
        uint private constant TEST = 1;
        uint private constant TEST = 1;
        uint private constant TEST = 1;
        uint private constant TEST = 1;
        uint private constant TEST = 1;
        uint private constant TEST = 1;
        uint private constant TEST = 1;
        uint private constant TEST = 1;
        uint private constant TEST = 1;
      }
    

👎 Examples of incorrect code for this rule

High number of states

      pragma solidity 0.4.4;
        
        
      contract A {
                uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
        uint private a;
      }
    

Version

This rule was introduced in Solhint 1.1.5

Resources