Skip to content

v0.5.1

Choose a tag to compare

@github-actions github-actions released this 08 Feb 10:47
· 50 commits to main since this release
v0.5.1
1e4b8d9

Bug Fixes

Z011: Fixed deprecation detection in nested contexts

Previously, ziglint failed to detect deprecated function calls inside try expressions, catch blocks, and other nested AST contexts. This was due to incomplete AST traversal in the linter.

Fixed detection for:

  • std.meta.intToEnum() - deprecated in favor of @enumFromInt()
  • std.meta.TagPayloadByName() - deprecated in favor of TagPayload with @field()
  • std.enums.nameCast() - deprecated in favor of @enumFromInt(@intFromEnum())
  • std.unicode.utf8Decode() - deprecated in favor of utf8DecodeAssumeValid()
  • And many other deprecated functions that were previously missed

Technical details:

  • Fixed visitChildren() to recursively visit all child nodes for unhandled AST node types
  • Now catches deprecations in try expressions, catch blocks, and other complex contexts
  • Added test corpus to prevent regressions

Example - now detects:

pub fn main() !void {
    // Previously missed, now detected:
    _ = try std.meta.intToEnum(MyEnum, 1);
}

Code Quality

  • Fixed Z011 violation in ziglint's own codebase: replaced deprecated std.mem.trimLeft with std.mem.trimStart
  • Fixed Z007 violations: eliminated 20 duplicate ModuleGraph imports across test functions
  • Added test cases for deprecated functions we don't yet detect (marked as skipped for future work)

Improvements

  • Added --verbose flag with timing information for performance analysis
  • Added per-rule timing breakdown to verbose output
  • Improved verbose output with colors and rule summary
  • Better directory linting with verbose logging

Known Limitations

Detection still requires improvement for:

  • Deprecated methods on local variables (requires flow analysis)
  • Deprecated const values that aren't function calls

Installation

mise use github:rockorager/ziglint@v0.5.1

Or download pre-built binaries from the release assets.