10 releases (6 breaking)
| 0.7.3 | Jan 4, 2026 |
|---|---|
| 0.7.2 | Nov 17, 2025 |
| 0.6.0 | Jun 23, 2025 |
| 0.5.0 | Jun 14, 2025 |
| 0.0.1 | Nov 5, 2022 |
#477 in Parser implementations
33KB
466 lines
Consistent Whitespace
A utility that checks for consistent whitespace across your file(s).
Usage
Basic Usage
Check the current directory for consistent whitespace:
consistent_whitespace
Check specific files or directories:
consistent_whitespace path/to/file.txt path/to/directory/
Whitespace Preferences
By default, the tool accepts either tabs or spaces as long as they are consistent within each file. You can enforce specific whitespace types:
consistent_whitespace --whitespace spaces
consistent_whitespace --whitespace tabs
consistent_whitespace --whitespace either
Examples
GitHub Actions
name: Continuous Integration (CI)
on: pull_request
permissions:
contents: read
jobs:
check-whitespace:
name: Check Whitespace
runs-on: ubuntu-24.04
steps:
- name: Checkout code.
uses: actions/checkout@v4
- name: Check whitespace consistency.
uses: docker://ghcr.io/developerc286/consistent_whitespace:0.7.3
with:
args: .
GitLab CI
check-whitespace:
image: ghcr.io/developerc286/consistent_whitespace:0.7.3
script:
- consistent_whitespace .
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
Installation
Binary
version="v0.7.3" && wget -O - "https://github.com/DeveloperC286/consistent_whitespace/releases/download/${version}/x86_64-unknown-linux-musl.tar.gz" | tar xz --directory "/usr/bin/"
Cargo
cargo install consistent_whitespace@0.7.3
Docker
You can use the Docker image published to ghcr.io/developerc286/consistent_whitespace.
docker run --rm -v $(pwd):/workspace -w /workspace ghcr.io/developerc286/consistent_whitespace:0.7.3 .
Issues/Feature Requests
Report issues or request features on our GitHub Issues.
Dependencies
~5–9MB
~161K SLoC