rumk
A fast linter for Makefiles written in Rust, inspired by tools like Ruff (Python) and Rumdl (Markdown).
Features
- Fast: Written in Rust for maximum performance
- Comprehensive: Checks syntax, style, best practices, and security issues
- Configurable: Customize rules via TOML configuration
- Auto-fix: Automatically fix common issues
- Multiple output formats: Text, JSON, and GitHub Actions annotations
Installation
Usage
Basic usage
# Check a Makefile
# Check a specific file
# Check all Makefiles in a directory
# Auto-fix issues
# Explain a specific rule
Configuration
Create a .rumk.toml file in your project:
[]
= { = true, = { = 100 } }
= { = true, = { = "UPPER_CASE" } }
= { = true }
[]
= ["vendor/*", "third_party/*"]
= ["MK101"]
Rules
Syntax Rules (MK000-MK099)
MK001- Recipes must use tab indentationMK002- Invalid variable syntax
Style Rules (MK100-MK199)
MK101- Line exceeds maximum lengthMK102- Variable naming conventionMK103- Target naming convention
Best Practice Rules (MK200-MK299)
MK201- Non-file targets should be .PHONYMK202- Avoid hardcoded absolute paths
Example
Given this Makefile:
:
FOO = # Hardcoded path
:
Running rumk check produces:
Makefile:2:1: [MK001] Recipe must be indented with tab, not spaces [*]
Makefile:4:7: [MK202] Variable 'FOO' contains hardcoded absolute path
Makefile:1:1: [MK201] Target 'clean' should be declared .PHONY
Makefile:6:1: [MK201] Target 'test' should be declared .PHONY
Found 4 issues in 1 file (1 file checked)
Run with --fix to automatically fix issues
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
MIT License - see LICENSE for details.