kibit
kibit copied to clipboard
Need a possibility for Check failures to return exit code 0 with findings
The default behaviour (for application) is to consider the exit code 0 as successful execution and all the others as failure. In our case we use Maven and run Leiningen as a library with lein-maven-plugin (ingesolvoll). Even though lein-kibit run is successful it returns exit code 1 to Maven plugin which is interpreted as plugin failure. This forces us to use -fn (never fail) flag in Maven, since it causes build errors. Tried other workarounds too with no success (eg. running with forced exit 0... kibit || true) Could it be possible eg. to add a switch to kibit which would allow Check failures to exit with code 0 and show all failures in Clojure scripts ?
It would be nice to have failure output as xml / html files if needed, Jenkins plugin showing failures would be useful too.
This is the only plugin I could find for Clojure script static analysis. Awesome plugin. Keep up the good work :)
@JJN2 if lein-kibit run is successful and prints no suggestions then it should exit 0. Or do you mean that it ran successfully and printed out suggestions?
In this case lein-kibit check prints out few findings from Clojure scripts and exits with value 1. Problem is that non-zero exit values are interpreted in Maven as a plugin failure (plugin fails to execute normally and exits with non-zero error code) and causes build errors. I understand that for lein-kibit exit value 1 and found suggestions on Clojure scripts represents a 'failed' run (since suggestions were found)… a bit like running failing JUnit tests with Maven What I wish for is eg. a switch where for example one could determine exit code value.. even 0 when suggestions are found. So that when used eg. via Maven (lein-maven-plugin) this exit code would not cause build errors or interpreted as a failed plugin execution (non-zero exit code). Sadly lein-maven-plugin does not have a configuration which would ignore failed lein plugin runs. Ofcourse one option could be creating an issue on lein-maven-plugin development to include ingore failures option, but I have a feeling that project is not so active.. ??
What is the purpose of running kibit via Maven? Do you want a non-zero exit code somewhere in the chain further up? How do you signal to Maven that Kibit didn't return successfully, without making it look like the plugin itself has failed to execute?
Clojure scripts are just one part of a larger system in where Maven is used as a build tool. Maven is used also to run static analysis for all source code in the system. Additional build tools or applications are not wanted there since they would contaminate building process with their own requirements and needs. That is the base reason why everything (when possible) is done via Maven.
The only plugin I found which runs Leiningen as a stand-alone library in Maven is lein-maven-plugin: (https://github.com/ingesolvoll/lein-maven-plugin), it returns any exit value lein plugin might return and there is no possibility to ignore it (which are interpreted as plugin execution failures in Maven). In this case plugin execution failure when suggestions are found (Suppressed exit with value 1), so lein-maven-plugin returns lein-kibit exit code as it is. At the moment this is handled by running Maven with 'fail never' flag. So this is not a show stopper but at least a nuisance.
Do you think this is rather a lein-maven-plugin (https://github.com/ingesolvoll/lein-maven-plugin) issue or could there be a configuration (someday) in lein-kibit where user is allowed to alter exit value (even value 0) for lein-kibit in cases where it finds suggestions? ... or is there a better work around to handle this?