tidy.zig
tidy.zig
[!NOTE] This is a work in progress.
Code tidiness checks based on TigerBeetle’s
tidy.zig, simplified and parameterised for reuse across projects. See
Matklad’s notes on tidy scripts.
Checks
- line length
- leftover FIXMEs
- leftover
dbg()calls - large git blobs
Usage
Drop tidy.zig in your project or add this project as a dependency:
zig fetch --save git+https://github.com/fng97/tidy.zig
Then wire it up in build.zig:
const test_step = b.step("test", "Run tests");
// Optionally pass options here. See `build.zig` for the available options and their defaults.
const tidy_dep = b.dependency("tidy", .{
.target = b.graph.host,
.optimize = .ReleaseSafe,
// Bump max line length to 120 from default of 100.
.line_column_max = 120,
});
test_step.dependOn(blk: {
const exe = b.addTest(.{ .name = "tidy_checks", .root_module = tidy_dep.module("tidy") });
const run = b.addRunArtifact(exe);
break :blk &run.step;
});
Attribution
TigerBeetle is licensed under Apache 2.0. See
src/NOTICE_TIGERBEETLE.