What seems like many many moons ago, I released a powershell script that could detect many different “TSQL Smells“. Whilst it worked, I was never very happy with the interface, it was clunky and didnt feel quite ‘right’. One of my longer term aims was to do something about that and make TSQLSmells more accessible.
Static code analysis would have been mine prime choice, and that would make perfect sense, however after much blood, sweat and tears (and time wasted) i found that extending code analysis in SSDT is not supported, so i gave up disheartened.
However, poking around the other day I stumbled over a solution to my problems, and rekindled my interest, how about creating a visual studio add-in and dropping it straight into SSDT ?
So, without any further ado here it is “TSQL Smells in SSDT”, to run drop two files from here into your Visual Studio Addin directory, something like Documents\Visual Studio 2010\Addins and run SSDT. You may see an error saying it has failed to load (error number 80131515), in which case use the “Unblock” option in the file properties of the dll.
Now, load up your project and in the R-Click menu you should see “SQL Smells”.
Click that and your error list will be populated with the Smells that you know and love.
If that is to noisy for you, you can reduce the noise by unselecting smells in Tools->Options->TSQL Smells.
Have fun and let me know how you get on 🙂
Massive Hat Tip to Jamie Thomson for being a guinea pig for this process
If you are running VS2013, then the .addin needs a small tweak.
Please see http://bit.ly/1bRB1SN for details.