Z033: Avoid redundant words in type names
Type names should avoid words that add no meaningful information, such as "Value", "Data", "Context", "Manager", "State", "utils", and "misc". Function and value names are outside this rule's scope.
This rule is disabled by default as it can be controversial. Enable it in your .ziglint.zon if you want stricter naming enforcement.
Examples
Bad (when enabled)
const UserData = struct {
name: []const u8,
};const StateManager = struct {
state: State,
};const AppContext = struct {
config: Config,
};Good
const User = struct {
name: []const u8,
};const StateStore = struct {
state: State,
};const App = struct {
config: Config,
};Configuration
To enable this rule, add to your .ziglint.zon:
.{
.rules = .{
.Z033 = .{ .enabled = true },
},
}Rationale
From the Zig Style Guide:
Avoid these words in type names:
- Value
- Data
- Context
- Manager
- State
- utils, misc, or somebody's initials
Everything is a value, all types are data, everything is context, all logic manages state. Nothing is communicated by using a word that applies to all types.
These words are so generic that they don't help readers understand what the type actually represents. Compare:
UserDatavsUser- "Data" adds nothingConfigManagervsConfigStoreorConfigRegistry- "Manager" is vagueAppContextvsApporRuntime- "Context" is overused
This rule is disabled by default because:
- Some legitimate uses exist (e.g., wrapping external APIs)
- Migration burden on existing codebases can be high
- The "right" alternative name is often context-dependent