Woof ๐
Rust-powered Go linter โ Lightning fast, zero dependencies.
Woof brings Pythonic code quality tools to the Go ecosystem. It combines the familiar interface of Ruff with Go-specific linting rules, enabling you to:
- โก Lint at Speed โ Parallel processing with Rayon for maximum throughput
- ๐จ Format Consistently โ Opinionated Go code formatting
- ๐ง Auto-Fix Issues โ Automatically fix common code problems
- ๐ฆ Single Binary โ Zero runtime dependencies, just one executable
Whether you're working on a small Go module or a large monorepo, Woof provides the tools you need to maintain code quality.
Features
| Feature | Description |
|---|---|
| โก Blazing Fast | Written in Rust, parallel file processing |
| ๐ง Auto-Fix | Automatically fix common issues with --fix |
| ๐ฏ Go-Native | Designed specifically for Go code patterns |
| ๐ JSON Output | CI-friendly output with --format json |
| ๐ GitHub Actions | Native GitHub Actions annotation support |
| ๐ Configurable | TOML-based configuration (woof.toml) |
| ๐งช Tree-sitter | Precise parsing with tree-sitter |
Requirements
- Rust 1.70+ (for building from source)
- Go 1.18+ (for linting Go projects)
Installation
From crates.io (coming soon)
From source
Quick Start
# Check current directory
# Check with auto-fix
# Format files in place
# Initialize configuration
Usage
Linting
Check a file or directory for issues:
Apply auto-fixes where possible:
Formatting
Format files in place:
Check if files are formatted (CI mode):
Output to stdout:
List all rules
Lint Rules
| Code | Name | Description | Severity |
|---|---|---|---|
| E001 | unused-import | Detects unused import statements | Warning |
| E101 | line-too-long | Line exceeds maximum length | Error |
| E201 | trailing-whitespace | Line has trailing whitespace | Warning |
| E301 | empty-block | Block contains no statements | Error |
| E401 | mixed-tabs-spaces | Indentation uses both tabs and spaces | Error |
| D001 | exported-missing-doc | Exported identifier missing documentation | Warning |
Configuration
Initialize a configuration file:
Example woof.toml
# Woof configuration
[]
= "1.21"
= true
= ["vendor/", "*.gen.go"]
[]
= ["E", "W", "D"]
= ["E101"]
[]
= true
= "error"
= { = 100 }
[]
= true
= 4
= 120
= false
Command Line Options
Global Options
| Option | Description |
|---|---|
--all |
Enable all lint rules |
--ignore <RULES> |
Disable specific rules (comma-separated) |
--select <RULES> |
Select specific rules (comma-separated) |
--config <FILE> |
Configuration file path |
--threads <N> |
Number of threads to use |
--format <FORMAT> |
Output format: text, json, github |
Check Options
| Option | Description |
|---|---|
--fix |
Apply auto-fixes where possible |
--exit-non-zero-on-fix |
Exit with error code if fixes applied |
Format Options
| Option | Description |
|---|---|
--check |
Check if files are formatted without modifying |
--stdout |
Write formatted output to stdout |
Project Structure
Woof/
โโโ ๐ src/
โ โโโ ๐ rules/ # Lint rules implementation
โ โโโ ๐ formatter/ # Code formatter
โ โโโ ๐ config/ # Configuration handling
โ โโโ main.rs # Entry point
โโโ ๐ benches/ # Performance benchmarks
โโโ ๐ testdata/ # Test fixtures
โโโ ๐ Cargo.toml # Rust project config
โโโ ๐ woof.toml # Example configuration
โโโ ๐ README.md # This file
Platform Support
| Platform | Status | Recommendation |
|---|---|---|
| Linux | โ Fully Supported | โญ Production |
| macOS | โ Fully Supported | โญ Production |
| Windows | โ Fully Supported | Development/Testing |
Development
Building
Testing
Running benchmarks
Adding a new rule
- Create a new struct in
src/rules/builtin.rs - Implement the
Ruletrait - Add the rule to
get_all_rules()insrc/rules/mod.rs
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the Apache License 2.0. See LICENSE for more information.
Made with โค๏ธ by GWinfinity
Acknowledgments
- Inspired by Ruff โ An extremely fast Python linter
- Uses tree-sitter for parsing