C# Documentation Rules

Currently we are using Enterprise Edition Version 7.9.3 (build 33349)
I am trying to identify a violation rule for C#, this rule occurs if an element is completely missing a documentation header, or if the header is empty. In C# the following types of elements can have documentation headers: classes, constructors, delegates, enums, events, finalizers, indexers, interfaces, methods, properties, and structs.

Documentation header mean XML comments. Please find the below example. I tried to look through all the existing rules but couldn’t find any.

/// Joins a first name and a last name together into a single string.

/// The first name to join.
/// The last name to join.
/// The joined names.
public string JoinNames(string firstName, string lastName)
return firstName + " " + lastName;

Can you please let me know if any rule is already existing, if so how do we add that particular rule to the list? What is the rule number?
Please let me know if any additional information is needed.


Hey there.

Since no such rule exists (to the best of my knowledge), I’ve moved your topic to Suggest New Features > New Rules.

However, I’m guessing you’re inspired by the StyleCop rule SA1600 and, since there is a Roslyn implementation, if you reference the StyleCop analyzers and make sure SA1600 is turned on, such issues should be automatically imported into SonarQube (see Importing Third-Party Issues > Notes on external .NET issues).

Thank you Colin for your quick response. To confirm, we need to add StyleCop analyzers as reference in all the projects that need these rules to implement. Then SonarQube will automatically import those issues when it scans those projects. Is my understanding correct?

Hi @shasi. Yes, that’s correct.