ErikEJ.DacFX.TSQLAnalyzer
1.0.7
Prefix Reserved
Requires NuGet 5.0 or higher.
dotnet add package ErikEJ.DacFX.TSQLAnalyzer --version 1.0.7
NuGet\Install-Package ErikEJ.DacFX.TSQLAnalyzer -Version 1.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ErikEJ.DacFX.TSQLAnalyzer" Version="1.0.7"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ErikEJ.DacFX.TSQLAnalyzer --version 1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ErikEJ.DacFX.TSQLAnalyzer, 1.0.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ErikEJ.DacFX.TSQLAnalyzer as a Cake Addin #addin nuget:?package=ErikEJ.DacFX.TSQLAnalyzer&version=1.0.7 // Install ErikEJ.DacFX.TSQLAnalyzer as a Cake Tool #tool nuget:?package=ErikEJ.DacFX.TSQLAnalyzer&version=1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ErikEJ.DacFX.TSQLAnalyzer
This .NET 8 library allows you to run 140+ static T-SQL code analysis rules against .sql files, and report any rule violations.
Installation
Install the latest package from NuGet.
Getting started
Once installed, you can use the library to analyze T-SQL files. The library comes with a couple of useful extension methods to help you format the output of the analysis.
using ErikEJ.DacFX.TSQLAnalyzer;
using ErikEJ.DacFX.TSQLAnalyzer.Extensions;
var files = new List<string> { "C:\\scripts\\sproc.sql" };
var analyzerOptions = new AnalyzerOptions();
analyzerOptions.Scripts.AddRange(files);
var analyzerFactory = new AnalyzerFactory(analyzerOptions);
AnalyzerResult result;
try
{
result = analyzerFactory.Analyze();
}
catch (ArgumentException aex)
{
Console.WriteLine(aex.Message);
return 1;
}
if (result?.Result == null)
{
Console.WriteLine("No result from analysis");
return 1;
}
foreach (var err in result.Result.InitializationErrors)
{
Console.WriteLine(err.Message);
}
foreach (var err in result.Result.SuppressionErrors)
{
Console.WriteLine(err.Message);
}
foreach (var err in result.Result.AnalysisErrors)
{
Console.WriteLine(err.Message);
}
if (result.ModelErrors.Count > 0)
{
foreach (var dex in result.ModelErrors)
{
Console.WriteLine(dex.Value.Format(dex.Key));
}
}
if (result.Result.AnalysisSucceeded)
{
foreach (var err in result.Result.Problems)
{
var warning = err.GetOutputMessage(analyzerOptions.Rules);
Console.WriteLine(warning);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- ErikEJ.DacFX.SqlServer.Rules (>= 1.3.0)
- ErikEJ.DacFX.TSQLSmellSCA (>= 1.3.0)
- Microsoft.Extensions.FileSystemGlobbing (>= 9.0.2)
- Microsoft.SqlServer.DacFx (>= 162.5.57)
- System.ComponentModel.Composition (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.7 | 39 | 2/19/2025 |
1.0.6 | 40 | 2/19/2025 |
0.9.0-preview.2 | 36 | 2/19/2025 |
0.9.0-preview.1 | 38 | 2/19/2025 |
Initial