| Crates.io | csvlint |
| lib.rs | csvlint |
| version | 1.0.0 |
| created_at | 2025-06-21 06:22:48.426807+00 |
| updated_at | 2025-06-21 06:43:31.725818+00 |
| description | A CSV linter that validates CSV files according to RFC 4180 |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1720562 |
| size | 64,155 |
A fast CSV linter written in Rust that validates CSV files according to RFC 4180.
git clone https://github.com/blackstar257/csvlint-rs
cd csvlint-rs
cargo build --release
The binary will be available at target/release/csvlint.
cargo install csvlint
csvlint [OPTIONS] <FILE>
<FILE> - The CSV file to validate-d, --delimiter <DELIMITER> - Field delimiter in the file (default: ",")
, (comma), \t (tab), | (pipe), : (colon), ; (semicolon)-l, --lazyquotes - Try to parse improperly escaped quotes--rfc4180 - Strict RFC 4180 compliance mode (enforces comma delimiter and CRLF line endings)-h, --help - Print help information-V, --version - Print version information# Validate a standard CSV file
csvlint data.csv
# Validate with strict RFC 4180 compliance (comma delimiter, CRLF line endings)
csvlint --rfc4180 data.csv
# Validate a tab-separated file
csvlint --delimiter '\t' data.tsv
# Validate a pipe-separated file
csvlint --delimiter '|' data.txt
# Validate with lazy quote parsing (more lenient)
csvlint --lazyquotes data.csv
0 - File is valid1 - File does not exist or parsing was halted due to fatal errors2 - File contains validation errors\r\n) line endingsThe linter detects several types of CSV format violations:
This tool can also be used as a Rust library:
[dependencies]
csvlint = "0.1.0"
use csvlint::validate;
use std::fs::File;
use std::io::BufReader;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let file = File::open("data.csv")?;
let reader = BufReader::new(file);
let result = validate(reader, b',', false)?;
if result.errors.is_empty() {
println!("File is valid!");
} else {
for error in result.errors {
println!("{}", error);
}
}
Ok(())
}
cargo build
cargo test
cargo test integration_tests
This implementation provides comprehensive support for RFC 4180 compliance:
--rfc4180)When using the --rfc4180 flag, the linter enforces:
\r\n) as specified in RFC 4180,) only"He said ""Hello"".")In standard mode, the linter is more lenient and accepts:
--lazyquotes\r\n line endingstext/csv MIME type specificationThis Rust implementation leverages the excellent csv crate for parsing, which provides:
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.