GithubHelp home page GithubHelp logo

unsolvedcypher / csvlint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clever/csvlint

0.0 2.0 0.0 53 KB

library and command line tool that validates a CSV file

License: Apache License 2.0

Go 47.81% Makefile 52.19%

csvlint's Introduction

csvlint

csvlint is a library and command-line utility for linting CSV files according to RFC 4180.

It assumes that your CSV file has an initial header row.

Everything in this README file refers to the command-line utility. For information about the library, see godoc.

Installing

Standalone executables for multiple platforms are available via Github Releases.

You can also compile from source:

go get github.com/Clever/csvlint/cmd/csvlint

Usage

csvlint [options] /path/to/csv/file

Options

NOTE: The default settings validate that a CSV conforms to RFC 4180. By changing the settings, you can no longer strictly guarantee a CSV conforms to RFC 4180.

  • delimiter: the field delimiter, can be any single unicode character
    • default: "," (comma)
    • valid options: "\t", "|", "เฎƒ", etc
    • if you want multi-character delimiters, you're probably doing CSVs wrong
  • lazyquotes: allow a quote to appear in an unquoted field and a non-doubled quote to appear in a quoted field. WARNING: your file may pass linting, but not parse in the way you would expect

Examples

$ csvlint bad_quote.csv
Record #1 has error: bare " in non-quoted-field at line 2, column 6

unable to parse any further

$ csvlint --lazyquotes bad_quote.csv
file is valid

$ csvlint mult_long_columns.csv
Record #2 has error: wrong number of fields in line
Record #4 has error: wrong number of fields in line

$ csvlint --delimiter='\t' mult_long_columns_tabs.csv
Record #2 has error: wrong number of fields in line
Record #4 has error: wrong number of fields in line

$ csvlint one_long_column.csv
Record #2 has error: wrong number of fields in line

$ csvlint perfect.csv
file is valid

Exit codes

csvlint uses three different exit codes to mean different things:

  • 0 - the file is valid
  • 1 - couldn't parse the entire file
  • 2 - could parse the file, but there were lint failures

Vendoring

Please view the dev-handbook for instructions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.