Jump to content

  • Log In with Google      Sign In   
  • Create Account


Tool to identify refactorable code?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Promit   Moderators   -  Reputation: 6621

Like
0Likes
Like

Posted 22 June 2012 - 02:11 PM

I'm wondering if there's a tool that can do this, but searching isn't yielding what I want. I do not want a tool that deals with the boring tedium involved in refactoring like moving variables and functions around. I'm looking for a code analysis tool which I can feed C++ code to, and will find code that looks like it should be refactored. That would mean doing things like finding duplicate code (could be a diff, but variable naming could vary), finding similar structural arrangements that are repeated, finding class member functions that have no dependencies on that class, etc.

Any suggestions?

Edited by Promit, 22 June 2012 - 02:12 PM.


Sponsor:

#2 Mike.Popoloski   Crossbones+   -  Reputation: 2890

Like
2Likes
Like

Posted 22 June 2012 - 02:51 PM

The latest Visual Studio has this built in, at least for the ultimate edition. It'll check for code that looks like it could be pulled out into its own function, or that duplicates functionality elsewhere. I haven't tried running it on a large code base yet, but a few contrived tests that I did seem to work alright.
Mike Popoloski | Journal | SlimDX

#3 e‍dd   Members   -  Reputation: 2105

Like
3Likes
Like

Posted 22 June 2012 - 02:56 PM

There's quite a sizeable list of suggestions for tools that can find similar code in this stack overflow thread.

In one of the talks at Microsoft's recent Going Native event, the dude that did a talk on Clang claimed that they wrote a tool relatively easily that found all the places where functions taking std::string arguments were being passed the result of std::string::c_str() calls, creating unnecessary conversions. Of course, he would say it's easy, but it might be worth checking out. I can't remember if it was from his actual talk, or it was something he mentioned in one of the Q&As. EDIT: found it, this video at around 1:20:50.

Edited by e‍dd, 22 June 2012 - 03:14 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS