Note: I am not asking what the golden code-to-comment ratio is, nor am I attempting to affix a particular ratio to our team. Instead, we would like to improve how well our codebase is documented (we started with a "code should document itself" mentality), which can be accomplished either by removing dead code or by adding comments to live code, and we would like to measure how well we are going about doing that by measuring this ratio multiple times over the course of several months. Also note that I would like to actually measure the amount of comments we have, so something that gets LOC from the generated IL won't work.
How would I go about getting the code-to-comments ratio for a C# project? Would I need to write my own parsing script, or is there something in Roslyn I can leverage? Do any major IDEs carry this functionality directly? As a bonus, can I filter out "punctuation", such as extra whitespace, comment delimiters (//
and /* */
), and opening/closing curly brackets?