Lint Rules Reference
Complete reference for all documentation linting rules enforced by DocBuilder.
Overview
DocBuilder’s linter enforces opinionated, non-configurable rules based on Hugo and DocBuilder best practices. Rules are classified by severity:
| Severity | Impact | Build Behavior |
|---|---|---|
| Error | Blocks build | Exit code 2, CI fails |
| Warning | Should fix | Exit code 1, CI passes |
| Info | Informational | Exit code 0, CI passes |
Rule Categories
- Filename Rules (Errors)
- Content Rules (Errors)
- Structure Rules (Warnings)
- Asset Rules (Warnings/Info)
Filename Rules
All filename rules are Errors that block the build.
Rule: Uppercase Letters
Pattern: [A-Z] in filename
Rationale:
- Filenames become URL slugs in Hugo
- Uppercase causes case-sensitivity issues across platforms (macOS/Windows case-insensitive, Linux case-sensitive)
- Creates inconsistent URLs:
API-Guide.mdβ/API-Guide/vs expected/api-guide/
Examples:
Auto-fix: Converts to lowercase: API-Guide.md β api-guide.md
Error Message:
Rule: Spaces in Filename
Pattern: [ ] (space character) in filename
Rationale:
- Spaces become
%20in URLs:My Doc.mdβ/my%20doc/ - Breaks some link parsers and shell commands
- Poor user experience with encoded URLs
Examples:
Auto-fix: Replaces spaces with hyphens: My Document.md β my-document.md
Error Message:
Rule: Special Characters
Pattern: Any character not in [a-z0-9-_.]
Rationale:
- Special characters unsupported by Hugo’s URL generation
- May require shell escaping in commands
- Can break on different filesystems
Invalid Characters: @, #, $, %, &, *, (, ), [, ], {, }, ;, :, ', ", <, >, ?, |, \, /, ~, `
Examples:
Auto-fix: Replaces special characters with hyphens: file@name.md β file-name.md
Error Message:
Rule: Leading/Trailing Hyphens or Underscores
Pattern: Filename starts or ends with - or _
Rationale:
- Creates malformed URLs:
/-docs/or/_temp/ - May be interpreted as hidden files on Unix systems
- Poor aesthetics and confusing navigation
Examples:
Auto-fix: Strips leading/trailing hyphens and underscores: -draft.md β draft.md
Error Message:
Rule: Invalid Double Extensions
Pattern: Multiple file extensions (e.g., .md.backup, .markdown.old)
Rationale:
- Hugo attempts to process files with
.mdor.markdownanywhere in the extension - Backup files, temp files cause build errors
- Whitelisted exceptions exist for embedded diagram formats
Whitelisted Double Extensions:
.drawio.png- Draw.io embedded PNG diagrams (editable).drawio.svg- Draw.io embedded SVG diagrams (editable)
Examples:
Auto-fix: Not automatically fixable (requires manual intervention)
Error Message:
Rule: Reserved Names
Pattern: Filenames that conflict with Hugo taxonomy URLs
Reserved Names: tags.md, categories.md (without namespace prefix)
Rationale:
- Hugo reserves
/tags/and/categories/URLs for taxonomy listings - Direct files cause URL conflicts and build errors
Examples:
Auto-fix: Adds prefix: tags.md β content-tags.md
Error Message:
Content Rules
Content rules validate the internal structure of markdown files.
Rule: Malformed Frontmatter YAML
Pattern: Invalid YAML syntax in frontmatter block
Rationale:
- Hugo silently skips pages with invalid frontmatter
- Page won’t render but no error is shown
- Causes missing documentation without obvious cause
Examples:
Auto-fix: Not automatically fixable (requires manual correction)
Error Message:
Rule: Missing Frontmatter Closing
Pattern: Frontmatter starts with --- but missing closing ---
Rationale:
- Hugo treats entire file as frontmatter
- No content rendered
- Page appears blank
Examples:
Auto-fix: Not automatically fixable (ambiguous where frontmatter should end)
Error Message:
Rule: Frontmatter Fingerprint
Pattern: Missing fingerprint: field, or fingerprint does not match content
Rationale:
- DocBuilder uses a frontmatter fingerprint to detect content changes reliably
- Helps avoid stale pages where content changed but metadata did not
- Enables deterministic updates of
lastmodonly when content meaningfully changes
Examples:
Auto-fix:
- Regenerates
fingerprintviadocbuilder lint --fix - If the fingerprint value changes, sets/updates
lastmodto todayβs UTC date (YYYY-MM-DD)
Error Message:
Rule: Broken Internal Links
Pattern: Link to non-existent local file
Rationale:
- Broken links lead to 404 errors in production
- Poor user experience
- Indicates stale or incorrect documentation
Examples:
Auto-fix: Not automatically fixable (can’t determine intent)
Error Message:
Structure Rules
Structure rules are Warnings that don’t block builds but should be addressed.
Rule: Missing Section Index
Pattern: Directory contains .md files but no _index.md
Rationale:
- Section won’t appear in navigation sidebar
- Directory appears empty in site structure
- No landing page for the section
Examples:
Auto-fix: Can generate basic _index.md with --fix --generate-indexes
Warning Message:
Rule: Deep Nesting
Pattern: Directory structure exceeds 4 levels deep
Rationale:
- Poor navigation UX (too many clicks)
- Overly complex information architecture
- Consider flattening or reorganizing
Examples:
Auto-fix: Not automatically fixable (requires architectural decision)
Warning Message:
Rule: Orphaned Assets
Pattern: Image file not referenced by any markdown file
Rationale:
- Bloats repository size
- May be leftover from deletions
- Indicates maintenance needed
Examples:
Auto-fix: Can list orphans with --fix --remove-orphans (prompts for confirmation)
Warning Message:
Rule: Mixed Naming Styles
Pattern: Same directory has different naming conventions
Rationale:
- Inconsistent developer experience
- Harder to remember filenames
- Looks unprofessional
Examples:
Auto-fix: Normalizes to kebab-case: getting_started.md β getting-started.md
Warning Message:
Asset Rules
Asset rules apply to images and other non-markdown files.
Rule: Image Filename Issues
Severity: Warning
Pattern: Same filename rules as markdown (spaces, uppercase, special chars)
Rationale:
- Same URL and filesystem concerns as markdown
- Image paths must be exact matches (case-sensitive)
Examples:
Auto-fix: Applies same transformations as markdown files
Warning Message:
Rule: Whitelisted Double Extensions
Severity: Info (explicitly allowed)
Pattern: .drawio.png or .drawio.svg files
Rationale:
- Draw.io exports editable diagrams as embedded format
- PNG/SVG contains both image and diagram source data
- Allows round-trip editing without separate source files
Examples:
Info Message:
Rule: Absolute URLs to Internal Assets
Severity: Warning
Pattern:  pointing to same repository
Rationale:
- Breaks in local development
- Not portable across deployments
- Should use relative paths
Examples:
Auto-fix: Not automatically fixable (requires manual verification)
Warning Message:
Rule: Large Binary Files
Severity: Warning
Pattern: Image/asset file exceeds 5 MB
Rationale:
- Slows Git operations (clone, fetch, pull)
- Poor repository performance
- Consider external hosting or optimization
Examples:
Auto-fix: Not automatically fixable (requires manual optimization)
Warning Message:
Standard File Exclusions
These files are automatically excluded from linting (never reported as errors):
README.md(root or in subdirectories)CONTRIBUTING.mdCHANGELOG.mdLICENSE.mdCODE_OF_CONDUCT.md- Files in
.git/directory - Files matching
.gitignorepatterns
Rationale: These are standard repository files, not documentation content processed by Hugo.
Rule Evolution
Linting rules evolve with DocBuilder versions. See Lint Rules Changelog for version history.
| DocBuilder Version | Rule Changes |
|---|---|
| 1.0 - 1.5 | Initial filename and frontmatter rules |
| 1.6+ | Enhanced frontmatter schema validation (future) |
| 2.0+ | Asset transformation rules (future) |
Exit Codes Summary
| Code | Meaning | Condition |
|---|---|---|
0 |
Success | No issues found (clean) |
1 |
Warnings | Warnings present, no errors |
2 |
Errors | Errors found (blocks build) |
3 |
Failure | Linter execution error |
Auto-Fix Capabilities
| Rule | Auto-Fixable | Method |
|---|---|---|
| Uppercase letters | β Yes | Convert to lowercase |
| Spaces | β Yes | Replace with hyphens |
| Special characters | β Yes | Replace with hyphens |
| Leading/trailing hyphens | β Yes | Strip |
| Double extensions | β No | Manual removal |
| Reserved names | β Yes | Add prefix |
| Malformed frontmatter | β No | Manual correction |
| Broken links | β No* | Manual fix (*Can detect only) |
| Missing section index | β οΈ Partial | Generate basic _index.md |
| Mixed naming styles | β Yes | Normalize to kebab-case |
| Image filename issues | β Yes | Same as markdown files |
| Large binary files | β No | Manual optimization |
See Also
- Setup Linting - Installation and usage guide
- CI/CD Integration - Automated validation
- Migration Guide - Cleaning up existing repositories
- ADR-005: Documentation Linting - Architecture decision
[lint-rules-reference](https://docs.home.luguber.info/_uid/cb491357-fc40-4fee-bddc-f68fee69c437/)