Skip to content

Commit 58ea619

Browse files
authored
Add info about how to ignore warning message (#710)
* Add info about how to ignore to warning message fixes #709 * PR review updates
1 parent 3c5615d commit 58ea619

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/DacpacTool/PackageAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void Analyze(TSqlModel model, FileInfo outputFile, FileInfo[] analyzers)
4646

4747
if (!rules.Any(r => r.Namespace == "SqlServer.Rules" || r.Namespace == "Smells"))
4848
{
49-
_console.WriteLine("DacpacTool warning SQLPROJ0001: No additional well-known rules files found, consider adding more rules via PackageReference - see the readme here: https://github.com/rr-wfm/MSBuild.Sdk.SqlProj/blob/master/README.md#static-code-analysis");
49+
_console.WriteLine("DacpacTool warning SQLPROJ0001: No additional well-known rules files found, consider adding more rules via PackageReference - see the readme here: https://github.com/rr-wfm/MSBuild.Sdk.SqlProj/blob/master/README.md#static-code-analysis. You can ignore this warning by adding '<NoWarn>$(NoWarn);SQLPROJ0001</NoWarn>' to your project file.");
5050
}
5151

5252
_console.WriteLine("Using analyzers: " + string.Join(", ", rules.Select(a => a.Namespace).Distinct()));

src/DacpacTool/VersionChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public async Task CheckForPackageUpdateAsync()
6868

6969
if (latestVersion > _versionProvider.CurrentPackageVersion())
7070
{
71-
_console.WriteLine($"DacpacTool warning SQLPROJ0002: You are not using the latest version of this SDK, please update to get the latest bug fixes, features and support. Modify your project file: '<Project Sdk=\"MSBuild.Sdk.SqlProj/{latestVersion}\">')");
71+
_console.WriteLine($"DacpacTool warning SQLPROJ0002: You are not using the latest version of this SDK, please update to get the latest bug fixes, features and support. Modify your project file: '<Project Sdk=\"MSBuild.Sdk.SqlProj/{latestVersion}\">'. You can ignore this warning by adding '<NoWarn>$(NoWarn);SQLPROJ0002</NoWarn>' to your project file.");
7272
}
7373
}
7474
#pragma warning disable CA1031 // Do not catch general exception types

test/DacpacTool.Tests/PackageAnalyzerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void RunsAnalyzerWithWarningsAsErrorsUsingWildcard()
115115

116116
testConsole.Lines.Count(l => l.Contains("Using analyzers: ")).ShouldBe(1);
117117
testConsole.Lines.ShouldContain($"Analyzing package '{result.fileInfo.FullName}'");
118-
testConsole.Lines.ShouldNotContain("DacpacTool warning SQLPROJ0001: No additional well-known rules files found, consider adding more rules via PackageReference - see the readme here: https://github.com/rr-wfm/MSBuild.Sdk.SqlProj/blob/master/README.md#static-code-analysis");
118+
testConsole.Lines.ShouldNotContain("DacpacTool warning SQLPROJ0001: No additional well-known rules files found, consider adding more rules via PackageReference - see the readme here: https://github.com/rr-wfm/MSBuild.Sdk.SqlProj/blob/master/README.md#static-code-analysis. You can ignore this warning by adding '<NoWarn>$(NoWarn);SQLPROJ0001</NoWarn>' to your project file.");
119119
testConsole.Lines.ShouldContain($"proc1.sql(1,47): Error SRD0006 : SqlServer.Rules : Avoid using SELECT *.");
120120
testConsole.Lines.ShouldContain($"-1(1,1): Error SRD0002 : SqlServer.Rules : Table does not have a primary key.");
121121
testConsole.Lines.Count(l => l.Contains("): Error ")).ShouldBe(2);
@@ -137,7 +137,7 @@ public void RunsAnalyzerWithoutAdditionalAnalyzers()
137137
// Assert
138138
testConsole.Lines.Count.ShouldBe(6);
139139

140-
testConsole.Lines[1].ShouldBe("DacpacTool warning SQLPROJ0001: No additional well-known rules files found, consider adding more rules via PackageReference - see the readme here: https://github.com/rr-wfm/MSBuild.Sdk.SqlProj/blob/master/README.md#static-code-analysis");
140+
testConsole.Lines[1].ShouldBe("DacpacTool warning SQLPROJ0001: No additional well-known rules files found, consider adding more rules via PackageReference - see the readme here: https://github.com/rr-wfm/MSBuild.Sdk.SqlProj/blob/master/README.md#static-code-analysis. You can ignore this warning by adding '<NoWarn>$(NoWarn);SQLPROJ0001</NoWarn>' to your project file.");
141141
testConsole.Lines.ShouldContain($"Analyzing package '{result.fileInfo.FullName}'");
142142
testConsole.Lines.Count(l => l.Contains("Using analyzers: ")).ShouldBe(1);
143143
testConsole.Lines.Count(l => l.Contains("): Error ")).ShouldBe(0);

0 commit comments

Comments
 (0)