How about a --message-format=sonar for clippy

I'd be curious to have the opinion of some of you before digging more into some code and see if I can find some time to hack something.

Clippy is a great tool and reports very well to stdout. There is also the possibility to output as JSON with --message-format=json. Sonarcloud has a documented standard that might be an interesting output format too.

Do you think it would make sense to add such a functionality to clippy? Should it be outside clippy? Below is some more information about the topic.

Why would you like to send it to Sonarcloud?

Well, some companies like to have metrics. Having all the metrics in the same place can be very useful. Sonarcloud is good for code quality, code coverage, and more. It supports a bunch of languages... but not Rust at the moment (there has been discussion and bug). Impossibility to export to such tools might even impede Rust adoption because it doesn't fit with the already existing processes in the company.

What already exists?

There is actually an existing solution in the form of a Java plugin: sonar-rust. I tested it with a locally deployed Sonarqube and it works well. But it does not work in the context of Sonarcloud because it's a plugin you have to deploy on the server... which is not possible on sonarcloud.io.

I expect this could be implemented as an independent program that processes Clippy's --message-format=json output. If so, that would be much simpler than integrating it all the way into Clippy/Cargo.

3 Likes