Skip to content

v0.8.0

Choose a tag to compare

@github-actions github-actions released this 30 Oct 21:03
· 16 commits to main since this release
v0.8.0
02de5eb

What's New

Z035: Use an alias instead of the qualified path

When a file declares a top-level alias such as const testing = std.testing;,
Z035 reports calls that spell the qualified path instead:

Z035: test.zig:9: use alias 'testing' instead of 'std.testing'

The declaration itself is never reported. This catches the file where one test
uses testing.expect(...) and a newly added test uses std.testing.expect(...).
Aliases of namespaces, types, functions, and values are matched by path.
Nested aliases report the longest match once.

A use is skipped when it is an argument to a call, or an operand of == or
!=, that also names the alias elsewhere in the expression. This keeps tests
such as expectEqual(alias, path) from receiving a suggestion that would make
the comparison vacuous.

Known limitations: only top-level aliases initialized directly from a path are
tracked, and path text is compared without resolving shadowed names.

Z035 is enabled by default. Running it over the Zig standard library produces
1,630 findings; running over the baskingspot repositories produced 124 findings
in 34 files.

Installation

mise use github:rockorager/ziglint@v0.8.0