Skip to content

Commit 496af34

Browse files
committed
Fix warnings.
1 parent 431d430 commit 496af34

8 files changed

Lines changed: 16 additions & 15 deletions

File tree

AspNetCoreAnalyzers.Tests/ASP004RouteParameterTypeTests/Valid.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace AspNetCoreAnalyzers.Tests.ASP004RouteParameterTypeTests
1+
namespace AspNetCoreAnalyzers.Tests.ASP004RouteParameterTypeTests
22
{
33
using Gu.Roslyn.Asserts;
44
using Microsoft.CodeAnalysis.Diagnostics;

AspNetCoreAnalyzers.Tests/DocumentationTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#pragma warning disable CA1056 // Uri properties should not be strings
2+
#pragma warning disable CA1305 // Specify IFormatProvider
23
namespace AspNetCoreAnalyzers.Tests
34
{
45
using System;
@@ -309,7 +310,7 @@ public MarkdownFile(string name)
309310

310311
public class CodeFile
311312
{
312-
private static readonly ConcurrentDictionary<Type, CodeFile> Cache = new ConcurrentDictionary<Type, CodeFile>();
313+
private static readonly ConcurrentDictionary<Type, CodeFile> Cache = new();
313314

314315
public CodeFile(string name)
315316
{
@@ -318,8 +319,8 @@ public CodeFile(string name)
318319

319320
public string Name { get; }
320321

321-
public string Uri => "https://github.com/DotNetAnalyzers/AspNetCoreAnalyzers/blob/master" + this.Name.Substring(SolutionDirectory.FullName.Length)
322-
.Replace("\\", "/", StringComparison.Ordinal);
322+
public string Uri => "https://github.com/DotNetAnalyzers/AspNetCoreAnalyzers/blob/master" + this.Name[SolutionDirectory.FullName.Length..]
323+
.Replace("\\", "/", StringComparison.Ordinal);
323324

324325
public static CodeFile Find(Type type)
325326
{

AspNetCoreAnalyzers/Analyzers/AttributeAnalyzer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ private static bool HasHttpVerbAttribute(MethodDeclarationSyntax methodDeclarati
983983
return false;
984984
}
985985

986-
private struct Replacement<T>
986+
private readonly struct Replacement<T>
987987
{
988988
internal readonly T Node;
989989

@@ -998,8 +998,8 @@ internal Replacement(T node, string? newText)
998998
internal ImmutableDictionary<string, string?> Property(string key)
999999
{
10001000
return this.NewText is { } value
1001-
? ImmutableDictionary<string, string>.Empty.Add(key, value)
1002-
: ImmutableDictionary<string, string>.Empty;
1001+
? ImmutableDictionary<string, string?>.Empty.Add(key, value)
1002+
: ImmutableDictionary<string, string?>.Empty;
10031003
}
10041004
}
10051005
}

AspNetCoreAnalyzers/CodeFixes/RenameParameterFix.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ semanticModel is { } &&
4040
cancellationToken => Renamer.RenameSymbolAsync(
4141
context.Document.Project.Solution,
4242
parameter,
43-
name,
44-
null,
43+
name!,
44+
context.Document.Project.Solution.Options,
4545
cancellationToken),
4646
nameof(RenameParameterFix)),
4747
diagnostic);

AspNetCoreAnalyzers/CodeFixes/RenameTypeFix.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ semanticModel is { } &&
4040
cancellationToken => Renamer.RenameSymbolAsync(
4141
context.Document.Project.Solution,
4242
parameter,
43-
name,
44-
null,
43+
name!,
44+
context.Document.Project.Solution.Options,
4545
cancellationToken),
4646
nameof(RenameParameterFix)),
4747
diagnostic);

AspNetCoreAnalyzers/Helpers/KnownSymbols/KnownSymbol.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
internal static class KnownSymbol
66
{
7-
internal static readonly ObjectType Object = new ObjectType();
8-
internal static readonly StringType String = new StringType();
7+
internal static readonly ObjectType Object = new();
8+
internal static readonly StringType String = new();
99
internal static readonly QualifiedType Boolean = Create("System.Boolean", "bool");
1010
internal static readonly QualifiedType DateTime = Create("System.DateTime");
1111
internal static readonly QualifiedType Decimal = Create("System.Decimal", "decimal");

AspNetCoreAnalyzers/Helpers/KnownSymbols/ObjectType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ internal ObjectType()
1414
this.ReferenceEquals = new QualifiedMethod(this, nameof(this.ReferenceEquals));
1515
}
1616
}
17-
}
17+
}

AspNetCoreAnalyzers/Helpers/KnownSymbols/StringType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ internal StringType()
1414
this.Equals = new QualifiedMethod(this, nameof(this.Equals));
1515
}
1616
}
17-
}
17+
}

0 commit comments

Comments
 (0)