How can we extend the SQLProj code analysis rules by adding our own custom rule?

advertisements

Currently .sqlproj files have 15 code analysis rules (SR0001 to SR0015). I would like to create my own code analysis rule to make sure that columns used in where clauses are indexed.

How would I extended the current .sqlproj code analysis so that I have a 16th (SR0016) custom code analysis rule.


Just noticed this.

Consider using SSDT Code Analysis Extensibility which has just been added back to SSDT and is available in the SSDT March 2014 release.

http://msdn.microsoft.com/en-us/library/dn632175%28v=vs.103%29.aspx (Visual Studio 2012 and 2013)

If you are using Visual Studio 2010 then visit: http://msdn.microsoft.com/en-us/library/dd172133%28v=vs.100%29.aspx (Visual Studio 2010)

Note the location you push your custom library to: http://wearedevs.blogspot.co.uk/2014/05/ssdt-march-2014-static-code-analysis.html

Also checkout http://dataidol.com/davebally/ssdt-tsql-smells-add-in/ (this will give you a leg up)