Overview
The line output format provides a simple, grep-friendly output style where each alert is printed on a single line. This format is compatible with many text editors and IDE error parsers that expect compiler-style error messages.The line format is ideal for integration with editors like Vim, Emacs, and tools that expect traditional compiler error output.
Usage
Enable line output with the--output flag:
The format name is case-sensitive. Use lowercase
line.Output Format
Each alert is printed on a single line with the following structure:The file path where the issue was found. May be absolute or relative depending on configuration.
The line number where the issue was found (1-indexed).
The column number where the match begins (0-indexed). This corresponds to
Span[0] in the Alert structure.The name of the rule that generated this alert (e.g., “Vale.Spelling”, “Google.Acronyms”).
The alert message describing the issue.
Example Output
Here are real examples of what the line output looks like:Path Handling
By default, Vale outputs the full absolute path for each file. The path format can be controlled with the--relative flag.
Absolute Paths (Default)
Relative Paths
Implementation Details
The line output is implemented incmd/vale/line.go:13-41:
Alerts are automatically sorted by position (line, then column) before being printed, ensuring consistent output order.
Exit Code Behavior
The line output format follows Vale’s standard exit code behavior:- Exit 0: No errors found (warnings and suggestions are OK)
- Exit 1: One or more errors found
Editor Integration
Many text editors can parse the line format automatically:Vim
Set Vale as the compiler for your filetype::make to run Vale and populate the quickfix list.
Emacs
Use compilation mode with Vale:VS Code
Configure a problem matcher in.vscode/tasks.json:
Parsing Examples
Using awk
Extract only error lines from a specific file:Using grep
Filter alerts by severity (requires additional metadata):Using Python
Parse line output programmatically:When parsing line output, remember that the message field (the last colon-separated component) may itself contain colons.
Limitations
The line format has some inherent limitations compared to JSON output: If you need this information, consider using JSON output instead:Comparison with Other Formats
| Feature | Line | CLI | JSON |
|---|---|---|---|
| Single line per alert | ✅ | ❌ | ❌ |
| Easy to parse | ✅ | ❌ | ✅ |
| Editor integration | ✅ | ❌ | ⚠️ |
| Includes severity | ❌ | ✅ | ✅ |
| Includes colors | ❌ | ✅ | ❌ |
| Shows full metadata | ❌ | ⚠️ | ✅ |
| grep-friendly | ✅ | ❌ | ❌ |
Common Use Cases
Continuous Integration
Simple error detection in CI:GitHub Actions
Pre-commit Hooks
Check staged files:Automated Reports
Generate simple text reports:Related Options
- Use
--output=CLIfor human-readable, color-coded output - Use
--output=JSONfor complete structured data - Use
--relativeto output relative paths (experimental) - Use
--sortto ensure consistent file ordering - Use custom templates for complete control over output format