Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ton-blockchain/acton/llms.txt

Use this file to discover all available pages before exploring further.

acton check is Acton’s built-in linter for Tolk smart contracts. It analyses every file reachable from the declared contract roots, test files, and standalone scripts, then reports diagnostics ranging from simple style suggestions to security-critical findings. The command integrates with CI through multiple machine-readable output formats, supports automatic safe fixes, and lets you tune rule severity at the project or per-contract level without touching source files.

Running the linter

1
Lint the whole project
2
Run acton check from the project root to check every lint root discovered from Acton.toml:
3
acton check
4
Acton scans:
5
  • Every contract declared in [contracts];
  • Every *.test.tolk file in the workspace;
  • Every standalone script file that defines a main() function.
  • 6
    Lint a single contract or file
    7
    Pass a contract name (as declared in Acton.toml) or a direct file path:
    8
    # By contract name
    acton check Counter
    
    # By file path
    acton check ./contracts/Counter.tolk
    
    9
    Prefer an explicit path such as ./contracts/Counter.tolk when a file name could be mistaken for a contract name defined in Acton.toml.
    10
    Apply automatic fixes
    11
    Rewrite fixable issues in place with --fix:
    12
    acton check --fix
    
    13
    --fix works only with the default plain terminal output. It applies only fixes that the linter marks as automatically applicable. The command can still exit with a non-zero status when unfixed diagnostics remain.

    Focused runs

    Explain a diagnostic code directly in the terminal:
    acton check --explain E002
    
    Run only a selected subset of rules during one pass:
    acton check --enable-only E003,E028
    
    Use full rule codes such as E003 or E028 for predictable matching.

    Output formats

    acton check
    
    Human-readable output with source locations, suitable for local development. The only format that supports --fix.
    --fix can only be used with the plain output format. Passing --fix alongside json, sarif, github, or gitlab causes Acton to exit with an error instead of rewriting files.

    Configuring rules in Acton.toml

    Store the project lint policy in Acton.toml. Use [lint] for global settings, [lint.rules] for project-wide rule levels, and [lint.rules.<ContractName>] for per-contract overrides.
    Acton.toml
    [lint]
    max-warnings = 0
    exclude = ["contracts/generated/*.tolk"]
    output-format = "sarif"
    
    [lint.rules]
    unused-variable = "deny"
    mutable-variable-can-be-immutable = "warn"
    
    [lint.rules.Counter]
    unused-variable = "allow"
    

    Rule levels

    LevelEffect
    allowDisables the rule entirely.
    warnReports as a warning (default for most rules).
    denyReports as an error; causes non-zero exit.

    Exclude patterns

    exclude accepts glob patterns matched against both project-root-relative and absolute paths:
    • Excluded contracts are skipped as lint roots in project-wide runs.
    • Explicit targets (acton check Counter) are still checked even if excluded.
    • Excluded dependency files are still parsed for imports and types, but their lint diagnostics are hidden.
    • Compiler errors are never hidden by exclude.

    Per-line suppression

    When only a single line needs an exception, suppress the rule inline rather than weakening the project policy:
    // check-disable-next-line unused-variable
    val legacy = oldLogic();
    
    Suppress multiple rules at once:
    // check-disable-next-line unused-variable, write-only-variable
    var tmp = 10;
    tmp = 20;
    
    Suppression rules:
    • Use rule names (unused-variable) not diagnostic codes (E001).
    • The comment applies only to the immediately following line.
    • The comment must use // and sit directly above the target line.
    • all suppresses every diagnostic for the next line.
    • Unknown rule names in the list are silently ignored.
    • compiler-error (C001) and parse-error cannot be suppressed.

    Built-in rules

    Acton ships with the following rules. Rules marked Preview are still stabilising; rules disabled by default require explicit opt-in via [lint.rules] or --enable-only.

    Error rules (E-prefix)

    CodeRule nameDefaultQuick fixDescription
    E001unused-variablewarn✅ alwaysDeclared variables or parameters that are never used.
    E002mutable-variable-can-be-immutablewarn✅ sometimesvar declarations that are never mutated.
    E003deprecated-symbol-usewarnUsage of deprecated symbols.
    E004write-only-variablewarnVariables that are written to but never read.
    E005unused-importwarn✅ sometimesImports that are never referenced in the file.
    E006pure-function-call-unusedwarn@pure function calls whose return value is discarded.
    E007no-bounce-handlerwarnBouncing messages sent from onInternalMessage without a declared onBouncedMessage handler.
    E008used-ignored-identifierwarn✅ alwaysUse of identifiers explicitly marked unused with a leading underscore.
    E009mutable-parameter-can-be-immutablewarn✅ alwaysmutate parameters that are never mutated.
    E010acton-import-in-contracterrorImporting .acton files from within a contract dependency tree.
    E011asm-function-missing-safety-commentwarnasm function declarations without a SAFETY comment.
    E012send-mode-literalwarn✅ sometimesSend mode passed as a numeric literal instead of SEND_MODE_* constants.
    E013unauthorized-accessallow (Preview)Storage mutations reachable without an admin sender check.
    E014several-not-null-assertionswarn✅ alwaysRepeated not-null assertions such as foo!!.
    E015reserve-mode-literalwarn✅ sometimesReserve mode passed as a numeric literal instead of RESERVE_MODE_* constants.
    E016dangerous-send-mode-missing-safety-commentwarnDangerous send-mode flags used without a SAFETY comment.
    E017bless-call-missing-safety-commentwarnCalls to transformSliceToContinuation or asm BLESS functions without a SAFETY comment.
    E018random-requires-initializationwarn (Preview)Random value generation without a preceding random-seed initialisation.
    E019divide-before-multiplywarn (Preview)Division evaluated before multiplication, risking precision loss.
    E020duplicated-conditionwarnDuplicated conditions in if / else if chains.
    E021identical-conditional-brancheswarnConditional branches that are structurally identical.
    E022no-global-variableswarnTop-level global variable declarations.
    E024enum-cast-missing-safety-commentwarnNon-literal as casts to enum types without a SAFETY comment.
    E025missing-contract-headerwarnContract source with standard entrypoints but no contract header.
    E026unused-expressionwarnExpression statements whose computed values are immediately discarded.
    E027dict-type-usewarnUse of the low-level dict type.
    E028throw-requires-errors-enumwarnThrow codes referenced as bare constants instead of an errors enum.
    E029create-message-body-to-cellwarnMyMessage { ... }.toCell() inside a createMessage({ body: ... }) initializer.
    E030throw-requires-documented-error-valueallow (Preview)Throw codes from enum values that lack documentation.

    Style rules (S-prefix)

    CodeRule nameDefaultQuick fixDescription
    S001name-case-checkerwarn✅ alwaysInconsistent identifier naming style.
    S002explicit-return-typewarn✅ sometimesFunction declarations without explicit return types.
    S003field-init-can-be-foldedwarn✅ alwaysStruct field initialisation where the field name matches the variable name.
    S004method-can-be-staticwarnInstance methods where self is unused.
    S005message-should-be-namedwarnMessages created with createMessage(...) but named msg or message.
    S006create-message-inline-sendwarnInline sending of newly created messages: createMessage(...).send(...).
    S007import-path-can-use-mappingswarn✅ sometimesRelative import paths that could use a configured @mapping/... alias.
    S008negated-is-type-can-use-not-iswarn✅ alwaysNegated type checks written as !(a is T).

    Compiler rule (C-prefix)

    CodeRule nameDescription
    C001compiler-errorReports compiler and parse errors. Cannot be suppressed or overridden.

    CI integration

    Set max-warnings = 0 in Acton.toml to fail CI on any warning, then choose the output format that matches your platform:
    Acton.toml
    [lint]
    max-warnings = 0
    
    # Plain terminal output (local)
    acton check
    
    # GitHub Actions annotations
    acton check --output-format github
    
    # SARIF for code scanning upload
    acton check --output-format sarif --output-file build/reports/lint.sarif
    
    # GitLab Code Quality report
    acton check --output-format gitlab --output-file gl-code-quality-report.json
    
    For a complete GitHub Actions workflow example, see the CI setup guide.

    Build docs developers (and LLMs) love