diff options
4 files changed, 11 insertions, 2 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs index 8c4ba7d7d8..965dd89dd2 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs @@ -192,8 +192,6 @@ namespace MonoDevelop.CSharp.Project Dictionary<string, ReportDiagnostic> GetSpecificDiagnosticOptions () { var result = new Dictionary<string, ReportDiagnostic> (); - foreach (var warning in GetSuppressedWarnings ()) - result [warning] = ReportDiagnostic.Suppress; var globalRuleSet = IdeApp.TypeSystemService.RuleSetManager.GetGlobalRuleSet (); if (globalRuleSet != null) { @@ -204,6 +202,11 @@ namespace MonoDevelop.CSharp.Project if (ruleSet != null) { AddSpecificDiagnosticOptions (result, ruleSet); } + + foreach (var warning in GetSuppressedWarnings ()) { + result [warning] = ReportDiagnostic.Suppress; + } + return result; } diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding/CustomProjectRuleSetTests.cs b/main/tests/MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding/CustomProjectRuleSetTests.cs index 31e6b87168..263b5883d9 100644 --- a/main/tests/MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding/CustomProjectRuleSetTests.cs +++ b/main/tests/MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding/CustomProjectRuleSetTests.cs @@ -79,6 +79,9 @@ namespace MonoDevelop.CSharpBinding.Tests // Global ruleset option which is not overridden by project ruleset. Assert.AreEqual (ReportDiagnostic.Error, diagnosticOptions ["SA1003"]); + + // NoWarn set in project file directly should override project ruleset. + Assert.AreEqual (ReportDiagnostic.Suppress, diagnosticOptions ["SA1600"]); } } } diff --git a/main/tests/test-projects/ruleset/custom.ruleset b/main/tests/test-projects/ruleset/custom.ruleset index 6411b72e21..0d7baaab51 100644 --- a/main/tests/test-projects/ruleset/custom.ruleset +++ b/main/tests/test-projects/ruleset/custom.ruleset @@ -4,5 +4,7 @@ <Rule Id="SA1000" Action="Error" /> <Rule Id="SA1001" Action="Warning" /> <Rule Id="SA1002" Action="None" /> + <!-- Rule SA1003 defined in global ruleset --> + <Rule Id="SA1600" Action="Error" /> </Rules> </RuleSet>
\ No newline at end of file diff --git a/main/tests/test-projects/ruleset/ruleset.csproj b/main/tests/test-projects/ruleset/ruleset.csproj index 7b266eaccb..b4779cd891 100644 --- a/main/tests/test-projects/ruleset/ruleset.csproj +++ b/main/tests/test-projects/ruleset/ruleset.csproj @@ -9,6 +9,7 @@ <AssemblyName>ruleset</AssemblyName> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <CodeAnalysisRuleSet>custom.ruleset</CodeAnalysisRuleSet> + <NoWarn>SA1600</NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> |