Ericsson / codechecker

CodeChecker is an analyzer tooling, defect database and viewer extension for static and dynamic analyzer tools.
https://codechecker.readthedocs.io
Apache License 2.0
2.27k stars 383 forks source link

Reporting of new and resolved findings by email #3407

Open bulwahn opened 3 years ago

bulwahn commented 3 years ago

Is your feature request related to a problem? Please describe.

We are running various analyzer tools on a repository that is daily integrated. We then import the results into CodeChecker and use the diff tooling to identify the new reports and the resolved reports compared to the results of the previous day. We would like to inform all users/stakeholders on the current state, however, all potential users do not log in the system every day.

Describe the solution you would like

So, we would like that these results are distributed via email to a mailing list to which the stakeholders are subscribed to.

Describe alternatives you have considered

No alternatives considered.

Additional context

We can implement this easily by just querying the server through the REST API and then constructing and sending out the email. I see the possibility, though, that we can generalize such a script in a few places, so that it may be useful for others.

csordasmarton commented 3 years ago

From the 6.15.2 release the CodeChecker diff command has a separate exit code (2) if there is at least one report difference between baseline and newrun. So with this you can create a very simple shell script which can be used to send a mail if there is a new report in the difference:

#!/bin/bash

out=$(CodeChecker cmd diff -b my_remote_run -n ./reports --new 2>&1)
if [ $? -eq 2 ]; then
  printf "Send mail with the following output:\n$out";
fi

Email sending depends on your environment. For example you can use the mail command to send an email.

What do you think, is this an option for you? I don't know whether this few lines worth to create a separate script file in our repository but if this script would be more complex than we can put this to our repo of course.

bulwahn commented 3 years ago

We will implement this as a simple script exactly for our purpose first and share it in a pull request for further discussion. Maybe it ends up just being a bit of documentation how anyone else can write their own scripts, similarly to what we created.