Skip to content

v0.7.0

Choose a tag to compare

@github-actions github-actions released this 20 Oct 23:20
· 21 commits to main since this release
v0.7.0
7bf6c14

New Rule and a Z011 Detection Fix

This release adds Z034 and fixes Z011 so that deprecations on whole stdlib
modules are detected, not just deprecations on the called declaration.

What's New

Z034: Use writeAll for literal prints on Io.Writer

writer.print("literal", .{}) performs no formatting. With an empty args
tuple, print walks the literal and calls writeAll on it anyway. The empty
tuple exists only because print requires it, and the call reads as if
interpolation was intended. Z034 recommends writeAll instead.

The receiver must resolve to std.Io.Writer. Unresolved receivers are
skipped because std.debug.print and std.json.Stringify.print have the
same call shape but no writeAll alternative. Function parameters,
explicitly typed locals, top-level declarations, and fields of same-file
types are checked. Alias chains such as const Io = std.Io; and
const Writer = std.Io.Writer; resolve.

Fixes

Z011: Detect deprecated stdlib modules

A module deprecation is documented on the module declaration, not on each
function it contains. std.fs.path is deprecated in Zig 0.16, but its
functions are not, so std.fs.path.basename(path) passed without a warning.
Z011 now walks up the receiver's module chain and reports the deprecated
namespace:

Z011: main.zig:3: 'std.fs.path' is deprecated: Deprecated, use `std.Io.Dir.path`.

The marker parser also accepts the Deprecated, use ... comma form used by
128 doc comments in the Zig 0.16 standard library. Previously only
Deprecated:, Deprecated;, and Deprecated in favor of were recognized.

ziglint's own std.fs.path calls moved to std.Io.Dir.path.

Installation

mise use github:rockorager/ziglint@v0.7.0