diff --git a/src/files/analyzers/Analyzer.Microsoft.CodeAnalysis.NetAnalyzers.editorconfig b/src/files/analyzers/Analyzer.Microsoft.CodeAnalysis.NetAnalyzers.editorconfig index 1c6e69d..81094d4 100644 --- a/src/files/analyzers/Analyzer.Microsoft.CodeAnalysis.NetAnalyzers.editorconfig +++ b/src/files/analyzers/Analyzer.Microsoft.CodeAnalysis.NetAnalyzers.editorconfig @@ -1567,7 +1567,7 @@ dotnet_diagnostic.CA5400.severity = none # Enabled: False, Severity: warning dotnet_diagnostic.CA5401.severity = warning -# CA5402: Use CreateEncryptor with the default IV +# CA5402: Use CreateEncryptor with the default IV # Help link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5402 # Enabled: False, Severity: warning dotnet_diagnostic.CA5402.severity = warning diff --git a/tools/ConfigurationFilesGenerator/Program.cs b/tools/ConfigurationFilesGenerator/Program.cs index 7de46e3..56d8a9d 100644 --- a/tools/ConfigurationFilesGenerator/Program.cs +++ b/tools/ConfigurationFilesGenerator/Program.cs @@ -72,10 +72,10 @@ await Parallel.ForEachAsync(packages, async (item, cancellationToken) => var currentRuleConfiguration = currentConfiguration.Rules.FirstOrDefault(r => r.Id == rule.Id); var severity = currentRuleConfiguration != null ? currentRuleConfiguration.Severity : rule.DefaultEffectiveSeverity; - sb.AppendLine($"# {rule.Id}: {rule.Title}"); + sb.AppendLine($"# {rule.Id}: {rule.Title?.TrimEnd()}"); if (!string.IsNullOrEmpty(rule.Url)) { - sb.AppendLine($"# Help link: {rule.Url}"); + sb.AppendLine($"# Help link: {rule.Url?.TrimEnd()}"); } sb.AppendLine($"# Enabled: {rule.Enabled}, Severity: {GetSeverity(rule.DefaultSeverity)}"); @@ -92,16 +92,18 @@ await Parallel.ForEachAsync(packages, async (item, cancellationToken) => sb.AppendLine(); } + var text = sb.ToString().ReplaceLineEndings("\n"); + if (File.Exists(configurationFilePath)) { - if ((await File.ReadAllTextAsync(configurationFilePath, cancellationToken)).ReplaceLineEndings() == sb.ToString().ReplaceLineEndings()) + if ((await File.ReadAllTextAsync(configurationFilePath, cancellationToken)).ReplaceLineEndings("\n") == text) { return; } } configurationFilePath.CreateParentDirectory(); - await File.WriteAllTextAsync(configurationFilePath, sb.ToString(), cancellationToken); + await File.WriteAllTextAsync(configurationFilePath, text, cancellationToken); _ = Interlocked.Increment(ref writtenFiles); static string GetSeverity(DiagnosticSeverity? severity)