Question

I am using fxCop and NDepend a lot at the moment, and I keep seeing the items their reports generate which are "wrong"1 and wondering to myself, why can't these tools just go and make those fixes they are suggesting?

I get some are very hard to work out, but something like the fields should be marked readonly can very easily be applied with the information the tool has. However for me it means going to the tool, finding the item then placing the code in etc... Takes considerable time even for the smallest items.

I would even be happy if I had to confirm each change, in a similar to how CodeRush Xpress does with some it's refactorings.

So is there a reason why these tools do not do this?


1 Wrong is relative here, since something like the 1700 class of fxCop errors which are all about naming aren't bad code, but do make it harder for new developers to grapple the code.

Was it helpful?

Solution

Possibly because there isn't always -- or even most of the time -- a single, correct choice of refactoring to make. There usually are dozens of ways to refactor code so, that the amount of warnings will be reduced, but the one that is actually right for the project is something a developer should decide.

OTHER TIPS

Rob, this is something we (the NDepend Team) are thinking for the long term. But touching code is a domain much more sensitive than just analyzing it. And as said Rytmis, often there is not only one single choice for refactoring.

Certainly the best option will be to let NDepend send its refactoring commands to a solid existing refactorer such as R#. But this is pure supposition at the moment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top