coverity / coverity-sonar-plugin

51 stars 27 forks source link

coverity-sonar-plugin conflicts with sonar c-family plugin #31

Open gosp opened 4 years ago

gosp commented 4 years ago

Because multiple plugins bind the same file suffix, the error is: Language of file 'worker.c' can not be decided as the file matches patterns of both sonar.lang.patterns.cov-cpp : **/*.c and sonar.lang.patterns.c : **/*.c,**/*.h

the parameter: sonar.language is abandoned by sonarqube (https://community.sonarsource.com/t/what-is-the-alternative-to-the-sonar-language-property-in-the-current-version-of-sonarqube/3993)

I want to issues reported by coverity and c-family co-existing. So can coverity-sonar-plugin use the existing Language Key instead of creating new one?

TheRealPiotrP commented 4 years ago

@gosp were you able to find a resolution to this issue?

acho0819 commented 4 years ago

Hi @gosp and @TheRealPiotrP.

First of all, sorry for the late response and this is a known limitation of our plugin at the moment. I believe there is no workaround as far as I know. Also, c-family plugin is a paid version which we don't test it with too.

I believe you want to report issues report by coverity and c-family on a same file if there are issues, correct? If that is the case, you probably could control by setting the file extension to each plugin.

Anyways, we will try our best to find a good solution to this issue.

0xfff0 commented 4 years ago

Hello @acho0819,

I haven't got around to create a PR for this, but here is our workaround based on https://stackoverflow.com/a/39464548/1795913 and its comments:

Any thoughts on what might be missing? It seems to do the trick as far as I can tell..

acho0819 commented 4 years ago

@0xfff0 Thanks for the tip. To be honest, I have not played a lot with the file extensions. Like you said, it seems to do the trick. Also, you are correct that NCLOC is the only core metric that the Coverity plugin publish and it is always safe-guarded with try-catch block so that it won't cause any errors in case it conflicts with any other plugins.

Based on the comments from the stackoverflow(the link you shared), it seems like if the file extension is not configured, then the files will not be indexed. I am not sure if there is any side effects of this at the moment.

As far as I can tell, I don't think there is anything missing.