Sensor log level conventions

Hello,

I have a plugin that relies on a system command. The question is: what should/must be the behavior of my sensor when the system command does not exist or if its execution fails? Should I log warning or error messages and should the sensor fail and how?

Thanks for your feedback.

Sylvain

Hi @sbaudoin ,

We tend to fail the analysis, in order to not have the end user wrongly think the quality of the code is good while in fact it was simply not inspected.

Hello,

Thanks. So if I understand it well, the analysis should fail in the event the system command does not exist. Can you confirm, please?

@sbaudoin this is your plugin, so it depends on your use case, and how critical are your plugin measures/issues for the quality gate of projects.

Note that if you consider that the analysis should better complete, but you still want to notify the user that something goes wrong and that results might be incomplete, we have a new API to let Sensors report analysis warnings that will be displayed on project dashboard. See: https://github.com/SonarSource/sonar-scm-git/blob/1.8.0.1574/sonar-scm-git-plugin/src/main/java/org/sonarsource/scm/git/JGitBlameCommand.java#L61 as an example.

1 Like

Thanks for the details. The API looks interesting.