Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Public API metrics and violations #318

Merged
merged 1 commit into from
Dec 12, 2014

Conversation

lcintrat
Copy link
Contributor

@lcintrat lcintrat commented Dec 1, 2014

Add CxxPublicApiVisitor which counts documented and undocumented public API items.
Add UndocumentedApiCheck that creates issue for undocumented API.
Issue #307

API items.
Add UndocumentedApiCheck that creates issue for undocumented API.
@lcintrat lcintrat changed the title Add CxxPublicApiVisitor Add Public API metrics and violations Dec 1, 2014
@guwirth
Copy link
Collaborator

guwirth commented Dec 7, 2014

Hello @lcintrat, I think this is a very useful extension.

  • Had a similar idea but like to use doxygen warnings to detect missing comments. Your solution has the advantage that no additional tool is needed; drawback is that parser must work accurate (seems currently not always be the case).
  • Your design decision to say 'public API' must be in header files makes sense.
  • Not sure if 'protected' should count as public API?
  • In case of derived classes it is possible to derive comments in doxygen (\copydoc). Don't know if/how this is supported.

@lcintrat
Copy link
Contributor Author

lcintrat commented Dec 8, 2014

Thank you for your feedback @guwirth

  • I agree with you, this extension depends on the parser. Doxygen can also detect errors in the comments (missing arguments, invalid tag, and so on). However, this extension gives a metric, which is very useful.
  • IMHO 'protected' should be included in public API because a client can always derive a class and use protected methods, this is a normal case.
  • Since the extension does not validate the comments (at least, it should check that they are not empty), if a derived class has methods with Doxygen comments (including \copydoc or not), this is counted as documented public API.
  • As argued in Missing "public documented API" measure #307, the extension could also consider some predefined macro to detect public API (e.g. #define DLLEXPORT), but this is another achievement.

@wenns wenns merged commit b667835 into SonarOpenCommunity:master Dec 12, 2014
@wenns wenns added this to the M 0.9.2 milestone Dec 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants