Tya v0.55 Specification

Status: shipped. The tya version constant is 0.55.0. v0.55 extends tya lint with per-line opt-out comments, a machine-readable JSON output, a new TYAL0002 dead-code rule, and an AST-level autofix for TYAL0003. The language surface is unchanged from v0.54.

Theme

v0.49 shipped tya lint as a real subcommand. v0.50 added line- deleting --fix for TYAL0001 and warned on TYAL0003 / TYAL0004 / TYAL0005. v0.55 turns the lint into a CI-ready tool: finer-grained suppression, structured output, more analysis, and more autofix coverage.

CLI

tya lint [--fix] [--format=text|json] [paths...]

The lint subcommand owns its own --format flag. Other subcommands continue to recognise the global --format=human|json for diagnostic rendering.

Per-line opt-out

Comments of the form # tya-lint-ignore[: CODE[, CODE...]] suppress matching findings.

When --fix deletes a line, any opt-out comment on that line is removed with it (line-delete drops the whole line verbatim).

JSON output schema

{
  "version": "0.55.0",
  "findings": [
    {
      "path": "src/foo.tya",
      "line": 12,
      "col": 3,
      "code": "TYAL0001",
      "message": "unused local \"tmp\"",
      "autofixable": true
    }
  ]
}

Lint rules

Code Trigger Autofix
TYAL0001 unused local line-delete
TYAL0002 dead code after return / raise
TYAL0003 redundant if true / if false unwrap-if
TYAL0004 deeply nested block (depth ≥ 5)
TYAL0005 function body > 50 statements

TYAL0002 dead code after return / raise

Inside any block (function body, if arm, while body, for body, try / catch, match case), once a return or raise statement is reached every subsequent statement at the same nesting level emits TYAL0002 dead code after <return|raise> pointing at the unreachable statement.

The first unreachable statement is reported; the rule then continues so consecutive dead statements each yield one finding.

TYAL0003 AST autofix

tya lint --fix rewrites the source so that:

Lines outside the construct are left untouched. Edge cases (empty Then, empty Else, single-line bodies on the header line) fall back to no edit, matching the LSP code-action behaviour from v0.51.

Scope-out (v0.56+)