{"id":28962747,"url":"https://github.com/blackstar257/csvlint-rs","last_synced_at":"2025-06-24T03:11:58.598Z","repository":{"id":300346497,"uuid":"1005936702","full_name":"blackstar257/csvlint-rs","owner":"blackstar257","description":"A fast CSV linter written in Rust that validates CSV files according to RFC 4180.","archived":false,"fork":false,"pushed_at":"2025-06-21T06:42:55.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-21T07:18:46.719Z","etag":null,"topics":["csv","csv-linter","linter","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blackstar257.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-21T05:55:33.000Z","updated_at":"2025-06-21T06:42:29.000Z","dependencies_parsed_at":"2025-06-21T07:18:54.647Z","dependency_job_id":null,"html_url":"https://github.com/blackstar257/csvlint-rs","commit_stats":null,"previous_names":["blackstar257/csvlint-rs"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/blackstar257/csvlint-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackstar257%2Fcsvlint-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackstar257%2Fcsvlint-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackstar257%2Fcsvlint-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackstar257%2Fcsvlint-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blackstar257","download_url":"https://codeload.github.com/blackstar257/csvlint-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackstar257%2Fcsvlint-rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261595784,"owners_count":23182249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","csv-linter","linter","rust"],"created_at":"2025-06-24T03:11:58.042Z","updated_at":"2025-06-24T03:11:58.580Z","avatar_url":"https://github.com/blackstar257.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# csvlint (Rust)\n\nA fast CSV linter written in Rust that validates CSV files according to RFC 4180.\n\n## Installation\n\n### From source\n\n```bash\ngit clone https://github.com/blackstar257/csvlint-rs\ncd csvlint-rs\ncargo build --release\n```\n\nThe binary will be available at `target/release/csvlint`.\n\n### Using Cargo\n\n```bash\ncargo install csvlint\n```\n\n## Usage\n\n```bash\ncsvlint [OPTIONS] \u003cFILE\u003e\n```\n\n### Arguments\n\n- `\u003cFILE\u003e` - The CSV file to validate\n\n### Options\n\n- `-d, --delimiter \u003cDELIMITER\u003e` - Field delimiter in the file (default: \",\")\n  - Supports: `,` (comma), `\\t` (tab), `|` (pipe), `:` (colon), `;` (semicolon)\n- `-l, --lazyquotes` - Try to parse improperly escaped quotes\n- `--rfc4180` - Strict RFC 4180 compliance mode (enforces comma delimiter and CRLF line endings)\n- `-h, --help` - Print help information\n- `-V, --version` - Print version information\n\n### Examples\n\n```bash\n# Validate a standard CSV file\ncsvlint data.csv\n\n# Validate with strict RFC 4180 compliance (comma delimiter, CRLF line endings)\ncsvlint --rfc4180 data.csv\n\n# Validate a tab-separated file\ncsvlint --delimiter '\\t' data.tsv\n\n# Validate a pipe-separated file\ncsvlint --delimiter '|' data.txt\n\n# Validate with lazy quote parsing (more lenient)\ncsvlint --lazyquotes data.csv\n```\n\n## Exit Codes\n\n- `0` - File is valid\n- `1` - File does not exist or parsing was halted due to fatal errors\n- `2` - File contains validation errors\n\n## Features\n\n- **Full RFC 4180 Compliance**: Validates CSV files according to the RFC 4180 standard\n  - **Strict mode**: Enforces CRLF line endings and comma delimiters\n  - **Line ending validation**: Checks for proper CRLF (`\\r\\n`) line endings\n  - **Quote escaping validation**: Ensures proper quote doubling for escapes\n- **Multiple Delimiters**: Supports comma, tab, pipe, colon, and semicolon delimiters\n- **Detailed Error Reports**: Provides specific error messages with record numbers and error categories\n- **Field Count Validation**: Ensures all records have the same number of fields as the header\n- **Quote Validation**: Detects improperly quoted fields and bare quotes\n- **Lazy Quote Mode**: Optional mode to parse files with improperly escaped quotes\n- **Fast Performance**: Built with Rust for maximum performance using the csv crate\n- **Memory Efficient**: Processes files without loading everything into memory\n\n## Error Types\n\nThe linter detects several types of CSV format violations:\n\n- **Field Count Errors**: Records with different number of fields than the header\n- **Line Ending Errors**: Invalid line endings (RFC 4180 requires CRLF)\n- **Quote Errors**: Improperly quoted fields, bare quotes, unterminated quotes\n- **Unescaped Special Characters**: Special characters not properly escaped or quoted\n- **Encoding Errors**: Invalid UTF-8 sequences\n- **I/O Errors**: File reading errors\n\n## Library Usage\n\nThis tool can also be used as a Rust library:\n\n```toml\n[dependencies]\ncsvlint = \"0.1.0\"\n```\n\n```rust\nuse csvlint::validate;\nuse std::fs::File;\nuse std::io::BufReader;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let file = File::open(\"data.csv\")?;\n    let reader = BufReader::new(file);\n\n    let result = validate(reader, b',', false)?;\n\n    if result.errors.is_empty() {\n        println!(\"File is valid!\");\n    } else {\n        for error in result.errors {\n            println!(\"{}\", error);\n        }\n    }\n\n    Ok(())\n}\n```\n\n## Development\n\n### Building\n\n```bash\ncargo build\n```\n\n### Testing\n\n```bash\ncargo test\n```\n\n### Running integration tests\n\n```bash\ncargo test integration_tests\n```\n\n## RFC 4180 Compliance\n\nThis implementation provides comprehensive support for [RFC 4180](https://www.rfc-editor.org/rfc/rfc4180) compliance:\n\n### Strict Mode (`--rfc4180`)\nWhen using the `--rfc4180` flag, the linter enforces:\n- **Line Endings**: Must be CRLF (`\\r\\n`) as specified in RFC 4180\n- **Delimiter**: Must be comma (`,`) only\n- **Quote Escaping**: Strict validation of quote doubling (e.g., `\"He said \"\"Hello\"\".\"`)\n- **Field Structure**: Consistent field count across all records\n\n### Standard Mode (default)\nIn standard mode, the linter is more lenient and accepts:\n- Various line endings (LF, CRLF, CR)\n- Multiple delimiter types\n- More flexible quote handling with `--lazyquotes`\n\n### Compliance Features\n- ✅ **CRLF Line Endings**: Validates proper `\\r\\n` line endings\n- ✅ **Field Count Consistency**: Ensures all records have same field count\n- ✅ **Quote Escaping**: Validates doubled quotes within quoted fields\n- ✅ **Special Character Handling**: Validates proper quoting of fields containing commas, quotes, or line breaks\n- ✅ **Header Support**: Optional header row support\n- ✅ **MIME Type Compliance**: Follows `text/csv` MIME type specification\n\n## Performance\n\nThis Rust implementation leverages the excellent [csv crate](https://docs.rs/csv/) for parsing, which provides:\n\n- Zero-copy parsing where possible\n- Efficient memory usage\n- Fast field iteration\n- Robust error handling\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackstar257%2Fcsvlint-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackstar257%2Fcsvlint-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackstar257%2Fcsvlint-rs/lists"}