-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
first commit #1
first commit #1
Conversation
cf97ab4
to
f7d9ed7
Compare
The main thing I'm thinking about is stderr / stdout and exit codes - I think all the stuff being output right now should be output via stderr. I could imagine this program printing out the invalid lines to stdout in the future, for instance. I could see this (and the 'is valid') still printing to stdout, perhaps: for _, invalid := range invalids {
fmt.Println(invalid.Error())
} Also, we should exit with non-zero (and non-1 to distinguish from the other error cases) when the csv fails validation - that way scripting this will be easier. I'm a little concerned that there are some other tools for this - specifically, we could use something which has a csv schema potentially, and really tighten up what we accept. |
Why Agree about this, though: "we should exit with non-zero (and non-1 to distinguish from the other error cases) when the csv fails validation - that way scripting this will be easier" I looked into alternatives before I started and there are two of them, one written in JS and one written in Ruby. The one written in JS doesn't have any documentation and no one uses it (no watchers on Github). The one in Ruby looks pretty sweet (and supports schemas like you mentioned!), but it's not a command line utility, isn't standalone (so would be harder to distribute to XA, for instance), and adds a lot of complexity for features that we don't need right now. |
Tread carefully here--it looks like there are some strong opinions on both sides about how linters should treat exit codes. E.g. |
I suppose I am thinking that stdout should usually be easily parseable by machines, and stderr is usually for humans. I'm not 100% tied to this, though, and the current output format is not too hard to regex against if you were trying to incorporate this into a pipeline/workflow. And you've convinced me on the alternatives :). Definitely being able to direct people to a binary is crucial! |
Is that a common convention? I'd always considered it as "stdout is expected output of a program, stderr is for any errors, warnings, or logs that got you there" - basically that the command-line program is a function and the arguments are re: exit codes, I haven't read the |
Love the exit code idea. For stdout / stderr, this is not a really strong piece of evidence, but http://unix.stackexchange.com/questions/79315/when-to-use-redirection-to-stderr-in-shell-scripts#comment128689_79321 Again, as long as it's consistent and easily parseable by machines, I'm not too worried. I think I crossed us over into bikeshedding at some point on this one :-/ |
build/$(EXECUTABLE)-v$(VERSION)-linux-amd64: | ||
GOARCH=amd64 GOOS=linux go build -o "$@/$(EXECUTABLE)" $(PKG)/cmd/csvlint | ||
build/$(EXECUTABLE)-v$(VERSION)-windows-amd64: | ||
GOARCH=amd64 GOOS=windows go build -o "$@/$(EXECUTABLE).exe" $(PKG)/cmd/csvlint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is going to be so critical, love it
LGTM otherwise! |
I thought about getting rid of the test CSVs and instead using buffer data in the test file, but this ended up being convenient for running the command line tool against, as well.