All Projects → ashleyglee → TSqlRules

ashleyglee / TSqlRules

Licence: MIT license
TSQL Static Code Analysis Rules for SQL Server

Programming Languages

C#
18002 projects
SQLPL
141 projects

Projects that are alternatives of or similar to TSqlRules

SSDT-Continuous-Deployment-Project-Template
A project template aiming for easy Continuous Deployment of SSDT projects.
Stars: ✭ 38 (+31.03%)
Mutual labels:  visual-studio, ssdt
Pycraft
Pycraft is the OpenGL, open world, video game made entirely with Python. This project is a game to shed some light on OpenGL programming in Python as it is a seldom touched area of Python's vast amount of uses. Feel free to give this project a run, and message us if you have any feedback!
Stars: ✭ 39 (+34.48%)
Mutual labels:  visual-studio
1 First Steps
Setup Unity and Visual Studio on Mac and PC. Use Unity's editor to position, rotate and scale game objects. Understand prefabs. Write very basic code, and use Unity's Console. http://gdev.tv/cu2github (REF: FS_CU2)
Stars: ✭ 23 (-20.69%)
Mutual labels:  visual-studio
OpenCVB
OpenCV .Net application supporting several RGBD cameras - Kinect, Intel RealSense, Luxonis Oak-D, Mynt Eye D 1000, and StereoLabs ZED 2
Stars: ✭ 60 (+106.9%)
Mutual labels:  visual-studio
visual-studio-community-vagrant
Vagrant Environment for Visual Studio Community
Stars: ✭ 28 (-3.45%)
Mutual labels:  visual-studio
ExtendScript-for-Visual-Studio-Code
Extension that adds Adobe ExtendScript support to Visual Studio Code
Stars: ✭ 29 (+0%)
Mutual labels:  visual-studio
kontent-boilerplate-net
Kontent.ai Boilerplate for development of ASP.NET Core MVC applications.
Stars: ✭ 29 (+0%)
Mutual labels:  visual-studio
vscode-exts
Visual Studio Code Extensions
Stars: ✭ 33 (+13.79%)
Mutual labels:  visual-studio
FRC-Java-Tutorial
A tutorial on how to program a robot for use in the FIRST Robotics Competition
Stars: ✭ 52 (+79.31%)
Mutual labels:  visual-studio
VSHD
No description or website provided.
Stars: ✭ 105 (+262.07%)
Mutual labels:  visual-studio
VsTeXCommentsExtension
TeX comments rendering inside Visual Studio.
Stars: ✭ 48 (+65.52%)
Mutual labels:  visual-studio
HLSLToolsForVisualStudioConfigGenerator
Create shadertoolsconfig.json for Unity project
Stars: ✭ 50 (+72.41%)
Mutual labels:  visual-studio
CSharpCampReCapProject
Kodlama.io | C# Camp | Recap Project | Car Rental System | 2021
Stars: ✭ 17 (-41.38%)
Mutual labels:  sqlserver
VSTextMacros
An extension for Visual Studio 2012-2022 that brings back support for macros in text/code editors
Stars: ✭ 63 (+117.24%)
Mutual labels:  visual-studio
PrivateGalleryCreator
Create private extension galleries for Visual Studio
Stars: ✭ 96 (+231.03%)
Mutual labels:  visual-studio
Shareaza
Shareaza is a peer-to-peer client for Windows that allows you to download any file-type found on several popular P2P networks.
Stars: ✭ 103 (+255.17%)
Mutual labels:  visual-studio
assimp-Cpp-OpenGL-skeletal-animation
assimp C++ OpenGL skeletal animation visual studio 2015 project
Stars: ✭ 45 (+55.17%)
Mutual labels:  visual-studio
WebAPI2CLI
Execute ASP.NET Core WebAPI from Command Line
Stars: ✭ 28 (-3.45%)
Mutual labels:  visual-studio
experimental-tools
A bunch of quality refactorings and code fixes that are going to improve your C# development experience in Visual Studio and remove some common pain.
Stars: ✭ 19 (-34.48%)
Mutual labels:  visual-studio
DBTestCompare
Application to compare results of two SQL queries
Stars: ✭ 15 (-48.28%)
Mutual labels:  sqlserver

TSqlRules

TSQL Static Code Analysis Rules for SQL Server

alt text

Project Description

This library extends the SSDT (SQL Server Data Tools) functionality for creating static code analysis rules for Database Projects. The TSqlRules DLL can be added to Visual Studio to display errors and warnings inside the "Error List" window and can also be used with MSBuild.

Based on functionality described here:

Rule Overview

Design

  • SRD0001 - Table missing Primary Key

Performance

  • SRP0001 - Avoid using WAITFOR DELAY

Naming

  • SRN0001 - Non-alphanumeric Table name
  • SRN0002 - Column names should contain only alphanumeric characters.
  • SRN0003 - View should start with v and contain only alphanumeric characters. (vGetPerson)
  • SRN0004 - Trigger should start with tr and contain only alphanumeric characters. (trPerson)
  • SRN0005 - Stored Procedure should start with st and contain only alphanumeric characters. (stUpdatePerson)
  • SRN0006 - User Function should start with uf and contain only alphanumeric characters. (ufGetPersonInfo)
  • SRN0007 - Avoid using view in table names.

Usage Notes

The following references need to be updated if you are running different verions of Visual Studio. Currently they are configured for Visual Studio 2015 and are included in a Library folder to allow this to build online at Visual Studio Team Services. SSDT installs those DLL in the below referenced paths that you can use on your local.

  • Microsoft.Data.Tools.Schema.Sql.dll
  • Microsoft.Data.Tools.Utilities.dll
  • Microsoft.SqlServer.Dac.dll
  • Microsoft.SqlServer.Dac.Extensions.dll
  • Microsoft.SqlServer.TransactSql.ScriptDom.dll

Visual Studio 2013:

  • C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120\
  • C:\Program Files (x86)\Microsoft SQL Server\120\SDK\Assemblies

Visual Studio 2015:

  • C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\

Note: the path you copy the new rules DLL and PDB file to need to match the directory above for your VS version.

If you are adding as an extension to Visual Studio, the assembly needs to be signed.

  • Right-click the TSqlRules project and select Properties.
  • Click the Signing menu.
  • Check the "Sign the Assembly" box is checked.
  • In the Choose a strong name key file box, choose <New…> and enter "MyKeyRef" in the Create Strong Name Key dialog box, then enter a password.
  • On the File menu, click Save All.
  • On the Build menu, click Build Solution.

Microsoft Rules

Microsoft Rules included in Code Analysis by default:

Design

  • SR0001 - Avoid SELECT * in stored procedures, views, and table-valued functions.
  • SR0008 - Consider using SCOPE_IDENTITY instead of @@IDENTITY.
  • SR0009 - Avoid using types of variable length that are size 1 or 2.
  • SR0010 - Avoid using deprecated syntax when you join tables or views.
  • SR0013 - Specify values for output parameters in all code paths.
  • SR0014 - Maintain compatability between data types.

Naming

  • SR0011 - Avoid using special characters in object names.
  • SR0012 - Avoid using reserved words for type names.
  • SR0016 - Avoid using sp_ as a prefix for stored procedures.

Performance

  • SR0004 - Avoid using columns that do not have an index as test expressions in IN predicates.
  • SR0005 - Avoid using patterns that start with "%" in LIKE predicates.
  • SR0006 - In the comparison, simplify the expression that includes indexed columns.
  • SR0007 - Use ISNULL(column, default value) on nullable columns in expressions.
  • SR0015 - Extract deterministic function calls from WHERE expressions.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].