All Projects → tcartwright → SqlServer.Rules

tcartwright / SqlServer.Rules

Licence: MIT license
SQL Server static code analysis rules for SSDT database projects

Programming Languages

C#
18002 projects
powershell
5483 projects
TSQL
950 projects
XSLT
1337 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to SqlServer.Rules

Analyzer
🔍 Offline Analyzer for extracting features, artifacts and IoCs from Windows, Linux, Android, iPhone, Blackberry, macOS binaries, emails and more
Stars: ✭ 108 (+440%)
Mutual labels:  analysis, static-analysis
sbt-findbugs
FindBugs static analysis plugin for sbt.
Stars: ✭ 47 (+135%)
Mutual labels:  analysis, static-analysis
Zpa
A parser and source code analyzer for PL/SQL and Oracle SQL.
Stars: ✭ 124 (+520%)
Mutual labels:  analysis, static-analysis
Sonar Java
☕️ SonarSource Static Analyzer for Java Code Quality and Security
Stars: ✭ 745 (+3625%)
Mutual labels:  analysis, static-analysis
go-mnd
Magic number detector for Go.
Stars: ✭ 153 (+665%)
Mutual labels:  analysis, static-analysis
Structured Acceptance Test
An open format definition for static analysis tools
Stars: ✭ 10 (-50%)
Mutual labels:  analysis, static-analysis
SDA
SDA is a rich cross-platform tool for reverse engineering that focused firstly on analysis of computer games. I'm trying to create a mix of the Ghidra, Cheat Engine and x64dbg. My tool will combine static and dynamic analysis of programs. Now SDA is being developed.
Stars: ✭ 98 (+390%)
Mutual labels:  analysis, static-analysis
Binee
Binee: binary emulation environment
Stars: ✭ 408 (+1940%)
Mutual labels:  analysis, static-analysis
Scalpel
Scalpel: The Python Static Analysis Framework
Stars: ✭ 176 (+780%)
Mutual labels:  analysis, static-analysis
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-30%)
Mutual labels:  analysis, static-analysis
Phan
Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.
Stars: ✭ 5,194 (+25870%)
Mutual labels:  analysis, static-analysis
Cpp2IL
Work-in-progress tool to reverse unity's IL2CPP toolchain.
Stars: ✭ 689 (+3345%)
Mutual labels:  analysis, static-analysis
Security Code Scan
Vulnerability Patterns Detector for C# and VB.NET
Stars: ✭ 550 (+2650%)
Mutual labels:  analysis, static-analysis
Codechecker
CodeChecker is an analyzer tooling, defect database and viewer extension for the Clang Static Analyzer and Clang Tidy
Stars: ✭ 1,209 (+5945%)
Mutual labels:  analysis, static-analysis
Phpmnd
PHP Magic Number Detector
Stars: ✭ 431 (+2055%)
Mutual labels:  analysis, static-analysis
Dg
[LLVM Static Slicer] Various program analyses, construction of dependence graphs and program slicing of LLVM bitcode.
Stars: ✭ 242 (+1110%)
Mutual labels:  analysis, static-analysis
Detekt
Static code analysis for Kotlin
Stars: ✭ 4,169 (+20745%)
Mutual labels:  analysis, static-analysis
Go Ruleguard
Define and run pattern-based custom linting rules.
Stars: ✭ 402 (+1910%)
Mutual labels:  analysis, static-analysis
swap-detector
A library for detecting swapped arguments in function calls, and a Clang Static Analyzer plugin used to demonstrate the library.
Stars: ✭ 19 (-5%)
Mutual labels:  analysis, static-analysis
constyble
CSS complexity linter
Stars: ✭ 92 (+360%)
Mutual labels:  analysis, static-analysis

Yet Another Rule-set for SQL Server DataTools

Overview

Just what it says on the box: A library of SQL best practices as extended database code analysis rules checked at build. The rules can be installed locally as well as on the build server.

For a complete list of the current rules we have implemented see here. For example code see here

Organization

  • SqlServer.Dac - This hold visitors and other utility code
  • SqlServer.Rules - This holds the rules derived from SqlCodeAnalysisRule
  • SqlServer.Rules.Report - Library for evaluating a rule and serializing the result.
  • SqlServer.Rules.Generator - a quick console app to report on all rules in a Sql Project.
  • SqlServer.Rules.SolutionGenerator - a quick to do a build and evaluate the rules on a Sql Solution. Will also output the violated rules in an html report.
  • TestDatabase - a small Sql Solution to test with

Debug / Test

  1. Ensure SqlServer.Rules.SolutionGenerator is "Set as Startup Project"
  2. Set Command line arguments:
    1. Open up the properties for the SqlServer.Rules.SolutionGenerator project
    2. Select the Debug tab
    3. Enter one of the following scenarios:
    4. To debug the test harness db: --build --reportDirectory ".\Files" --solution "..\..\..\TestDatabase\TestDatabase.sln"
    5. To debug a Sql project: --build --reportDirectory ".\Files" --solution "{path}.sln"
  3. Add a break point in the SqlServer.Rules project in any of the rules you wish to debug

Note: if you need to debug the loading of the library see here

Install

An Install.bat is provided that will copy out the rules to all of the appropriate folder destinations. Or you can optionally follow these instructions:

Follow the instructions on MS Docs Install Static Code Analysis Rule.

The build should be installed to the template path %VSBIN%\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\{SqlEngine}\Extensions So for Visual Studio 2017 with DAC version 150 the path might be

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\Extensions\SqlServer.Rules

NOTES:

  • You will need to copy the binaries to every permutation of Visual Studio version and dac version that you wish to use the rules for.
  • When you have code analysis enabled and have compiled the project Visual Studio places a hard lock on the rule binaries. To update them or remove them you will need to close Visual Studio.

Project Configuration

  • Once the rules are compiled and installed to the appropriate directory then you can open up your SSDT project and enable code analysis by following these instructions: https://docs.microsoft.com/en-us/sql/ssdt/database-project-settings?view=sql-server-ver15#bkmk_code_analysis
  • After code analysis is enabled perform a rebuild. Any of the rules that are broke will show up as build warnings.
    • You can double click any of the warnings to be taken to the code location where the rule was broken at.
  • You can also optionally:
    • Enable / disable rules.
    • Set certain rules as errors so they will actually throw build errors.
    • Ignore rules in the sql files. See
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].