Acton
Linting rules

E028: no-global-variables

Disallows top-level `global` variable declarations.

Metadata

  • Code: E028
  • Rule: no-global-variables
  • Status: Stable since v0.0.1
  • Quick fix: not available

What it does

Disallows top-level global variable declarations.

Why is this bad?

Global mutable state makes contracts harder to reason about and audit. Keeping state in explicit storage structures and passing values through function scope is clearer and less error-prone.

Example

global counter: int
E028: global variable declarations are not allowed

Use instead:

struct State {
    counter: int
}
Source code

Last updated on

On this page