Skip to content

Commit

Permalink
chore: Solve errors caused by newer analyzers
Browse files Browse the repository at this point in the history
  • Loading branch information
Oskar Klintrot committed Jul 8, 2024
1 parent 8e8afa1 commit 50a3163
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/UpdatR/Domain/Csproj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private NuGetFramework GetTargetFramework()
return null;
}

private IDictionary<string, NuGetVersion> GetPackages()
private Dictionary<string, NuGetVersion> GetPackages()
{
var doc = new XmlDocument();

Expand Down
9 changes: 4 additions & 5 deletions src/UpdatR/Domain/DotnetTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace UpdatR.Domain;
internal sealed partial class DotnetTools
{
private readonly FileInfo _path;
private static readonly JsonSerializerOptions s_jsonSerializerOptions =
new JsonSerializerOptions(JsonSerializerDefaults.Web) { WriteIndented = true, };

private DotnetTools(FileInfo path)
{
Expand Down Expand Up @@ -178,18 +180,15 @@ out var updateTo

if (!dryRun && project.UpdatedPackages.Any())
{
var json = JsonSerializer.Serialize(
config,
new JsonSerializerOptions(JsonSerializerDefaults.Web) { WriteIndented = true, }
);
var json = JsonSerializer.Serialize(config, s_jsonSerializerOptions);

await File.WriteAllTextAsync(Path, json + Environment.NewLine);
}

return project;
}

private IEnumerable<string> GetPackageIds()
private List<string> GetPackageIds()
{
var tools = new List<string>();

Expand Down
14 changes: 14 additions & 0 deletions tests/UpdatR.UnitTests/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage(
"Performance",
"CA1861:Avoid constant arrays as arguments",
Justification = "Not important for unit tests",
Scope = "member",
Target = "~M:UpdatR.UnitTests.ProjectBuilder.WithDeprecatedPackage(System.String,System.String,System.String,System.Boolean)~UpdatR.UnitTests.ProjectBuilder"
)]

0 comments on commit 50a3163

Please sign in to comment.