Deprecation of "Common Server Rules" (SONAR-16051)

“Common Server Rules” were deprecated in SONAR-16051.

We are currently using the “Source files should have a sufficient density of comment lines” rule, which is a good indicator to measure comments in code for us.

The justification in the Jira is 'We don’t believe it makes sense to enforce such practice in 2022".

Can you elaborate on this assertion? I still believe in 2022 that good code should be commented, but maybe there are other way to measure this.


Hello @Vincent-Boissieu,

Our thought about the “density of comment lines” is:

  • it’s good to have comments in the code to help others understand the intent of a given piece of code when it makes sense
  • complex part of a code from a functional point of view should be documented and the code is probably a good place to do that instead of a separated document
  • at the same time, asking developers to have for every file a density of comments at 25% (the default value) is very artificial and doesn’t guarantee that in the end, the code will have better quality
  • developers may be tempted to write fake/useless comments “because Sonar ask it” to get a green quality gate and we don’t want that


Hello Alexandre,

Thanks for the quick and clear reply.

We understand your point of view, specially the point 4, but we still believe that the comment density would be useful for us (with a threshold lower than 25%).

Do you know any other rule that we can use are replacement?