Repository navigation
v0.5.1
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 ofTagPayloadwith@field()std.enums.nameCast()- deprecated in favor of@enumFromInt(@intFromEnum())std.unicode.utf8Decode()- deprecated in favor ofutf8DecodeAssumeValid()- 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.trimLeftwithstd.mem.trimStart - Fixed Z007 violations: eliminated 20 duplicate
ModuleGraphimports across test functions - Added test cases for deprecated functions we don't yet detect (marked as skipped for future work)
Improvements
- Added
--verboseflag 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.1Or download pre-built binaries from the release assets.