3

I'm working with gendarme for .net called by Sonar (launched by Jenkins). I've a lot of AvoidVisibleFieldsRule violations. The main violations are found in the generated files. As I can't do anything on it, i would like to exclude *.designer.cs from the scan.

I can't find a way to do that. There is a properties in Sonar to exclude generated files but it doesn't seem to be applied for gendarme.

Is there a way to do such a thing ?

Thanks for all

Julien
  • 31
  • 2

2 Answers2

2

Gendarme expects you provide an ignore list,

http://www.mono-project.com/Gendarme.FAQ

https://github.com/mono/mono-tools/blob/master/gendarme/self-test.ignore

The ignore file format is bit of weird, but you can learn it by experiments.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • I've looked a bit on this file but it seems really complicated. I can't found easy explication on the web... Do you know some ? – Julien May 02 '12 at 08:48
  • Try to write some and then you will learn it. I did that by experiments and I don't have much time to document the format yet. – Lex Li May 02 '12 at 13:16
0

Indeed that is actually not normal at all. Generated code is excluded by the plugin with the standard configuration. What version of the C# plugins are you using ? Anyway, the configuration property you can try is "sonar.exclusions" (see http://docs.codehaus.org/display/SONAR/Advanced+parameters). If you do not solve your problem right away, the best thing would be to drop a mail to the user mailing list (see http://www.sonarsource.org/support/support/) and send the verbose output of your build. To get this output simply add "-X" to the command line. Hope it helps

Alexandre Victoor
  • 3,104
  • 2
  • 27
  • 27
  • I've tried the sonar.exclusions but it seems to do anything. The fact is that the aspx file is linked to the designer file by a partial class. The report show the error in the aspx file but talks about a variable in the designer file. Seems really strange... I'm using sonar 2.13 and C# plugins ecosystem 1.3 – Julien May 02 '12 at 08:41