Overview
The CLI output format is Vale’s default output style, providing a human-readable, color-coded display of linting results. This format uses tables to organize alerts and includes visual indicators for different severity levels.The CLI format is automatically used when running Vale without specifying an output format.
Output Structure
The CLI output displays alerts grouped by file, with each file’s results shown in a formatted table followed by a summary line.Per-File Output
For each file with alerts, Vale displays:- An underlined file path header
- A table with columns for:
- Location: Line and column number (
line:column) - Severity: Color-coded severity level
- Message: The alert message
- Check: The rule name that triggered the alert
- Location: Line and column number (
Color Coding
Displayed in red. These are critical issues that cause Vale to exit with a non-zero status code.
Displayed in yellow. These are important issues that should be addressed but don’t cause a failing exit code.
Displayed in blue. These are optional improvements for your prose.
Example Output
Here’s what the CLI output looks like when linting a file:The table columns are automatically sized and aligned for optimal readability. Long messages may wrap depending on terminal width.
Summary Line
After displaying all file results, Vale prints a summary line with:- A checkmark (✔) or X (✖) symbol based on whether errors or warnings were found
- Total count of errors, warnings, and suggestions
- Number of files linted
Success Example
Failure Example
Implementation Details
The CLI output is implemented incmd/vale/color.go:15-85 and uses:
- pterm library for colored output
- tablewriter for formatted table rendering
- Unicode symbols (✔ U+2714, ✖ U+2716) for status indicators
Configuration Options
Controls whether text wrapping is enabled in table cells. When disabled, long messages may be truncated to fit the terminal width.
Using Text Wrapping
Exit Code Behavior
The CLI output format affects Vale’s exit code:- Exit 0: No errors found (warnings and suggestions are OK)
- Exit 1: One or more errors found
This behavior makes Vale suitable for use in CI/CD pipelines where you want builds to fail on errors but not on warnings or suggestions.
Special Cases
Standard Input
When linting from standard input, the summary line shows “stdin” instead of file count:Empty Results
If a file has no alerts, no output is shown for that file. Only the final summary is displayed:Related Options
- Use
--output=JSONfor machine-readable output - Use
--output=linefor simple line-based output - Use
--no-exitto prevent Vale from exiting with error code - Use
--sortto sort results by file path