Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • defining them directly through the SonarQube web interface using XPath expressions
  • or reusing custom ones rules defined in external tools such as FxCop, Gendarme or StyleCop

...

  1. Write a piece of XML to reference your custom coding rules. See formats below.
  2. Go to Settings > Configuration > General Settings > .Net FxCop or .Net Gendarme or C# StyleCop
  3. Paste this piece of your XML in .NET/C# XXX custom rules
  4. Click on Save .NET/C# XXX settings
  5. Restart your SonarQube server
  6. Activate your custom coding rules in your C# quality profiles

...

RULE_CLASS: name of the .NET rule class
ASSEMBLY.DLL: name of the dll assembly file containing the rule class
The XML fragment above assumes that the dll is located in the same directory as the standard FxCop assembly rules files.

Note: to help writing write this XML filesfile, "vladonemo" has written a C# program that generates this file based on your custom rules DLL. You can check this out on GitHub, but be aware that this it comes with no guarantee.

Example

...