How to make warning into error?

build
error
travis
warning

#1

In C++, we can be pedantic and convert all warnings into errors during compilation:

shell> g++ -Werror

Is there a similar feature in Julia? This switch could be very useful in Travis CI builds for mature packages. I am tired of flagging other’s packages about warnings whenever a new Julia version is released.


#2

That’s one of the worst option to be enabled in a project. It’s for dev’s to enable locally. I’ve had countless number of issues with projects that force it or have it on by default.

For depwarn we have it already. Not for warning in general, that may or may not be useful for local development.

Please don’t. This must not be the default or recommanded for any package. It won’t help fixing anything and it’ll only discourage people from supporting nightly/new release. It has already happened multiple times for many packages.

And please also don’t file those issues, especially not within a few months after new julia release. People usually know the depwarn exists and just haven’t got around to fix them yet or it could be a package without an active maintainer in which case the issue will also just be ignored. It’s usually easy and much more helpful to submit a pr.


#3

Thank you @yuyichao for your prompt reply. I was thinking of -Werror in Travis CI (so it is for devs only), but I will follow your suggestions and forget about it for now.


#4

A related question: Is there a way of finding out how many warnings were generated by running a given piece of code? Like a global warning counter? (I looked at the source for warn, but I could not find anything.)

in particular, I’d be interested in the number of warnings emitted by Pkg.test. This would make it possible to auto-generate statistics about warnings per commit.