Re: CRAP for C++ ?
Kaleb Pederson <[email protected]>
| Newsgroups | gmane.comp.programming.refactoring |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Nov 2, 2009 at 2:06 PM, Richard <[email protected]> wrote: > > In article <[email protected]>, > Srdjan Todorovic <[email protected]> writes: > >> I noticed an interesting Java project called CRAP4J (www.crap4j.org), >> to detect code that smells. While this seems really neat, there's no >> C++ support currently. > > The main problem is measuring test coverage. With languages that > contain reflection and dynamic code construction you can reflect over > the code and rewrite the code to emit coverage instrumentation in a > transparent manner. > > SourceMonitor does a great job of measuring cyclomatic complexity for > many languages, including C++. That will get you the complexity > measurements. Simian does a great job of measuring code duplication, > which while not a part of the "crap" metric is still useful. > > I recently saw mention of an interesting tool that instruments C++ by > having you feed it the preprocessed source which it then instruments > and feeds to the C++ compiler. That was an interesting approach that > I hadn't considered before. See <http://covtool.sourceforge.net/> Richard has a good point about code coverage. If you have legacy code (bad code?) then it's unlikely that you'll obtain high code coverage nor that it will be easy to add tests and obtain a high level of code coverage. I've used Bullseye Coverage for all of my C++ Code Coverage needs. It 'instruments' the code at compile time and then allows any number of application / test runs to be combined from which a coverage report can be generated. It works by acting as the compiler and sending an instrumented version of the source code through the actual underlying compiler. It provides a friendly UI for viewing the coverage data and making arbitrary queries. I have no affiliation with it (other than as a happy user) and can highly recommend it. -- Kaleb Pederson Blog - http://kalebpederson.com Twitter - http://twitter.com/kalebpederson ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/refactoring/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/refactoring/join (Yahoo! ID required) <*> To change settings via email: mailto:[email protected] mailto:[email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/