What software do you suggest to check spelling of comments contained in c/c++ source code (especially doxygen comments)? I'm looking something that will parse only comments so I can easily find mistakes and correct them.
The question is general but to be more specific - I'm us开发者_如何学JAVAing CodeLite IDE.
Emacs has ispell-comments-and-strings
which works pretty well from inside the editor. It relies on the syntax highlighting mechanism to identify comments and strings, so it works with any language for which you have good highlighting.
No idea if how you make it work with your IDE.
I needed something like this too. It needed to be able to run not only on Linux though.
I've seen that spell checking is often paired with an IDE (like with eclipse). I wanted a tool that was completely independent of any IDE however, because I wanted to be able to run it in automated/scripted contexts like Travis-CI builds or AppVeyor CI builds.
Looked around a little for such a tool and then decided to write my own.
What I came up with was pyspellcode which meets these needs. It's a python script that uses clang
and hunspell
which should readily run on Linux at least. The script:
- runs clang to get its AST dump output,
- reads through the AST info and finds the comment nodes,
- passes the words from those to
hunspell
for checking, and then - reports back words that weren't recognized.
What was an interesting surprise for me is how deeply clang parses C++ comments even into doxygen elements and embedded HTML markup. This made it possible to use clang's AST to do things like ignore words nested within <code>...</code>
blocks and I took advantage of that in the script.
The script's available from GitHub as a Zlib licensed open source project. It's just alpha software at the moment with at least one parsing bug in it but if there's interest in it, I'll give it more priority.
Hope this helps!
A good place to check doxygen comments seems to be doxygen itself. But it doesn't check spelling :?.
Quick, workaround that comes to my mind which may work I think, is to generate LaTeX output and then use LaTeX for spell checking. Another solution might be use of doxygen's Perl Module output format and write some code in Perl for spell checking (with Aspell or Ispell for example).
With an IDE it's much simpler, because any decent IDE should support spell checking for doc-comments (Eclipse CDT is an example)
精彩评论