5 Essential Tools To Improve Your Teams Code Quality

In today's post, I'm going to cover 5 really useful tools that I've been using for a number of years now that if used correctly, will really help you to improve your coding skills and ensure that your team work in a consistent manner. As a free-lancer who regularly works with several different clients throughout the year, I'm constantly forced to work in different ways and use different processes.  Over the years, the number one thing I've learnt is that if you don't enforce code quality into your build process, it won't get done.  

With that in mind, the tools I use to ensure quality on the projects I run, all have to be able to force the team to adhere to their rules and guidelines.  Obviously, some people don't like being forced into working a certain way.  We all get used to working in a way we like and when a tool forces us to write something in a way we don't always agree with, then it's a hard pill to swallow.  In these situations I normally say, if it's your own personal money, then fair enough you can do what you want.  If someone else is paying the bill then sometimes you need to work in ways that you might not fully agree with personally, but in the big picture benefits the company as a whole.  With that all said and done, I'll explain my top 5 code quality tools.

Essential Code Quality Tools

ReSharper:  Resharper's a tool I've used for about 7 years now.  It's got to the point that I don't know the difference between Visual Studio features and Resharper features at times.  For those of you new to .NET then this is something I strongly suggest that you check out.  It is a paid product, but it's worth the money.

No one writes perfect code the first time around (like perfect code even exists).  Instead, adding quality into your solution comes with gradual and consistent little improvements here and there.  Resharper will greatly help you in your refactoring efforts, which, in turn means you can get your work done quicker.. so if you ever need to explain to your boss why you need it, the simple answer is that after a year it will save you enough time to easily pay for itself, and then some.  

I guess Resharper's main feature is the refactoring suggestions and auto correcting functions.  Like coding standards, Resharper suggestions will mean you can write your code in a consistent manner with the rest of the team. Resharper has so many options and useful features that it could take up a series of posts to go into it all.  One of my personal favourites is the ability to run individual unit tests from within the test itself:


Out of all the tools I 100% suggest you start with Resharper first.  Resharper comes with a 30 day trial so you can install it hassle free without needing any credit-card etc.. upfront.  Head on over to the Jetbrains Resharper page here to find out more.

Stylecop:  I've previous written about stylecop in WHAT IS STYLECOP?, so I won't go into too much more detail here. Having a coding standard is great but trying to enfore that process is tricky.  This is where Stylecop comes in. Stylecop provides compile-time coding standards validation.  This is a huge advantage to ensure quality in your code base, as you can enfore the check in MSBuild or your build server so you can gurantee that everyone in your team is working in a consistent similiar fashion.  Stylcop can be installed via Nuget, via Windows and it can even hook into Resharper. For more information about how to do any of that, check out WHAT IS STYLECOP?

Trailing Whitespace Visualizer
:  
If you use Stylecop you'll likely bump into the no deadspace rule.  As the name suggests, ideally your source code files shouldn't contain any uneeded spaces... why so finicky?  It's mainly to make merges simple.  Now trying to manually do this is a waste of time and a pain in the bum.  Instead, you can use the Trailing Whitespace Visualizer visual studio extension to automatically do this for you.

As you can see from this epic screenshot, it highlights any deadspace in red.  When you save, you file and it will then automatically remove it for you.  This is such a simple plug-in, but it really does make your life a lot easier.

ReSpeller: My spelling and grammer is terrible..if you've read enough of this website then you may have noticed a typo or two (it's the reason I have a proof reader).  Spotting spelling mistakes in your code base is very easy to happen and unlike Word Visual Studio doesn't really prompt you.  In comes Respeller, whenever Respeller finds a spelling mistake in an identifier, comment or string literal, it immediately flags it.  From here you can either add the word to your allowed words, change the word or ignore it.  


To enable Respeller in Visual Studio, go to the 'Resharper' menu, -> 'Extension Manager' and in the extensions list search for 'respeller'.  

Gerrit:  One of the best ways to get good team knowledge about your code base and to also improve the quality of your code base is to ensure that one or more other people review your work.  Most teams achieve this via code reviews.  Like almost everything else in IT, to get this right you need to create a workflow that forces people to use it. From my experience, whenever any process is manual then sooner or later people will forget it, or try to break the rules.  When it comes to reviewing code you need to make sure code is reviewed before it gets committed to master, rather than trying to retrospectively.  I've used a few code review tools like UpSource but a lot of these don't allow you to hook into GIT to enable this forced workflow.  There maybe other/better tools that allow this but the one that I've used which works is called 'Gerrit'.  Gerrit is free and open source.  

You install it on a server, and then you add web hooks into your GIT tool of choice (mines Source-safe) and when you try to check your code in, instead of it getting committed to master, the request gets sent to Gerrit and stored in it's data store.  You can configure Gerrit in a number of ways but a usual approach is to prevent commits until two people have reviewed the code and passed the review.  Using this approach is pretty powerful as it forces your team into doing daily code-reviews and when it's part of your workflow, you will do code-reviews, rather than just make empty promises that you'll get around to it.

Conclusion

When I started writing this post, my initial thought was to write some huge monolithic list, but thinking about it and thinking about the tools that have really benefitted the quality on my projects, there is really only a handful of essential tools.  If you're reading this and it makes you decide to use Resharper, or Stylcop then that will have the biggest impact on your code-base.  If you already implement all of these tools, then give yourself a pat on the back as you're doing a lot more than the majority of teams out there.

submit to reddit

Jon D Jones

Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge

Back to top