Skip to content

Commit cc1f1b1

Browse files
authored
Merge pull request #1174 from Numpsy/no_fsharp_nowarn
Don't try to disable CA2243 warnings in the generated version info files for F#
2 parents 6803134 + c1077ca commit cc1f1b1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,9 +709,14 @@ public FSharpCodeGenerator(string ns)
709709
{
710710
}
711711

712+
protected override IEnumerable<string> WarningCodesToSuppress { get; } = [];
713+
712714
internal override void AddAnalysisSuppressions()
713715
{
714-
this.CodeBuilder.AppendLine($"#nowarn {string.Join(" ", this.WarningCodesToSuppress.Select(c => $"\"{c}\""))}");
716+
if (this.WarningCodesToSuppress.Any())
717+
{
718+
this.CodeBuilder.AppendLine($"#nowarn {string.Join(" ", this.WarningCodesToSuppress.Select(c => $"\"{c}\""))}");
719+
}
715720
}
716721

717722
internal override void AddComment(string comment)

test/Nerdbank.GitVersioning.Tests/AssemblyInfoTest.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public void FSharpGenerator(bool? thisAssemblyClass)
6161
// </auto-generated>
6262
//------------------------------------------------------------------------------
6363
64-
#nowarn ""CA2243""
6564
6665
namespace AssemblyInfo
6766
[<assembly: global.System.Reflection.AssemblyVersionAttribute(""1.3.0.0"")>]
@@ -121,7 +120,6 @@ public void FSharpGeneratorWithNamespace(string thisAssemblyNamespace, string ro
121120
// </auto-generated>
122121
//------------------------------------------------------------------------------
123122
124-
#nowarn ""CA2243""
125123
126124
namespace {(
127125
!string.IsNullOrWhiteSpace(thisAssemblyNamespace)

0 commit comments

Comments
 (0)