Coder Social home page Coder Social logo

tsql-smells's Introduction

TSQL-Smells

TSQL Smells Finder - SSDT

TSQL Code can smell, it may work just fine but there can be hidden dangers held within. Code that works just fine one day can break if the database schema changes underneath.

This project extends the Static Code Analysis rules inside SSDT, and therefore msbuild, to test that code meets certain rules. Each rule is individually selectable to be active and to have "Warnings as Errors". There are presently 43 rules covering:

  • Potential SQL Injection Issue
  • Avoid cross server joins
  • Use two part naming
  • Use of nolock / UNCOMMITTED READS
  • Use of Table / Query hints
  • Use of Select *
  • Explicit Conversion of Columnar data – Non Sargable predicates
  • Ordinal positions in ORDER BY Clauses
  • Change Of DateFormat
  • Change Of DateFirst
  • SET ROWCOUNT
  • Missing Column specifications on insert
  • SET OPTION usage
  • Use 2 part naming in EXECUTE statements
  • SET IDENTITY_INSERT
  • Use of RANGE windows in SQL Server 2012
  • Create table statements should specify schema
  • View created with ORDER
  • Writable cursors
  • SET NOCOUNT ON should be included inside stored procedures
  • COUNT(*) used when EXISTS/NOT EXISTS can be more performant
  • use of TOP(100) percent or TOP(>9999) in a derived table

Whitelisting of objects is supported with extended properties. Add to you project a script which sets the name of WhiteList against an object to be ignored. For example :

EXEC sys.sp_addextendedproperty @name=N’WhiteList’, @value=N’Ignore’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’PROCEDURE’,@level1name=N’WhiteListTestProc’

Further install instructions can be found on my blog here : http://dataidol.com/davebally/2015/03/23/getting-out-of-the-ground-with-tsql-smells/

tsql-smells's People

Contributors

davebally avatar snapjag avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.