Skip to content

Commit a61a051

Browse files
author
Bart Koelman
committed
Updated to latest Resharper version and removed workarounds for earlier versions
1 parent d120a35 commit a61a051

File tree

11 files changed

+11
-17
lines changed

11 files changed

+11
-17
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"jetbrains.resharper.globaltools": {
6-
"version": "2021.2.2",
6+
"version": "2021.3.0-eap10",
77
"commands": [
88
"jb"
99
]

JsonApiDotNetCore.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ JsonApiDotNetCore.ArgumentGuard.NotNull($EXPR$, $NAME$);</s:String>
9191
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_WHILE/@EntryValue">Required</s:String>
9292
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/PARENTHESES_GROUP_NON_OBVIOUS_OPERATIONS/@EntryValue">Conditional</s:String>
9393
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue">False</s:Boolean>
94+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_STATEMENT_CONDITIONS/@EntryValue">False</s:Boolean>
9495
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AFTER_MULTILINE_STATEMENTS/@EntryValue">1</s:Int64>
9596
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_INVOCABLE/@EntryValue">1</s:Int64>
9697
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_LOCAL_METHOD/@EntryValue">1</s:Int64>
9798
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_BEFORE_MULTILINE_STATEMENTS/@EntryValue">1</s:Int64>
99+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_BRACES_INSIDE_STATEMENT_CONDITIONS/@EntryValue">False</s:Boolean>
98100
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_FIXED_STMT/@EntryValue">True</s:Boolean>
99101
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_FOR_STMT/@EntryValue">True</s:Boolean>
100102
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_FOREACH_STMT/@EntryValue">True</s:Boolean>

src/JsonApiDotNetCore/Configuration/ResourceGraphBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private IReadOnlyCollection<EagerLoadAttribute> GetEagerLoads(Type resourceClrTy
281281
private static void IncludeField<TField>(Dictionary<string, TField> fieldsByName, TField field)
282282
where TField : ResourceFieldAttribute
283283
{
284-
if (fieldsByName.TryGetValue(field.PublicName, out var existingField))
284+
if (fieldsByName.TryGetValue(field.PublicName, out TField? existingField))
285285
{
286286
throw CreateExceptionForDuplicatePublicName(field.Property.DeclaringType!, existingField, field);
287287
}
@@ -291,7 +291,7 @@ private static void IncludeField<TField>(Dictionary<string, TField> fieldsByName
291291

292292
private void AssertNoDuplicatePublicName(ResourceType resourceType, string effectivePublicName)
293293
{
294-
var (existingClrType, _) = _resourceTypesByClrType.FirstOrDefault(type => type.Value.PublicName == resourceType.PublicName);
294+
(Type? existingClrType, _) = _resourceTypesByClrType.FirstOrDefault(type => type.Value.PublicName == resourceType.PublicName);
295295

296296
if (existingClrType != null)
297297
{

src/JsonApiDotNetCore/Queries/Internal/QueryableBuilding/SelectClauseBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using JsonApiDotNetCore.Queries.Expressions;
99
using JsonApiDotNetCore.Resources;
1010
using JsonApiDotNetCore.Resources.Annotations;
11-
using Microsoft.EntityFrameworkCore;
1211
using Microsoft.EntityFrameworkCore.Metadata;
1312

1413
namespace JsonApiDotNetCore.Queries.Internal.QueryableBuilding

src/JsonApiDotNetCore/Queries/Internal/QueryableBuilding/SkipTakeClauseBuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
namespace JsonApiDotNetCore.Queries.Internal.QueryableBuilding
88
{
99
/// <summary>
10-
/// Transforms <see cref="PaginationExpression" /> into <see cref="Queryable.Skip{TSource}" /> and <see cref="Queryable.Take{TSource}" /> calls.
10+
/// Transforms <see cref="PaginationExpression" /> into <see cref="Queryable.Skip{TSource}" /> and
11+
/// <see cref="Queryable.Take{TSource}(IQueryable{TSource},int)" /> calls.
1112
/// </summary>
1213
[PublicAPI]
1314
public class SkipTakeClauseBuilder : QueryClauseBuilder<object?>

src/JsonApiDotNetCore/Serialization/Objects/SingleOrManyData.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ public readonly struct SingleOrManyData<T>
1717
// to ensure ManyValue never contains null items.
1818
where T : class, IResourceIdentity, new()
1919
{
20-
// ReSharper disable once MergeConditionalExpression
21-
// Justification: ReSharper reporting this is a bug, which is fixed in v2021.2.1. This condition cannot be merged.
2220
public object? Value => ManyValue != null ? ManyValue : SingleValue;
2321

2422
[JsonIgnore]

src/JsonApiDotNetCore/Serialization/Request/Adapters/AtomicOperationObjectAdapter.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ private WriteOperationKind ConvertOperationCode(AtomicOperationObject atomicOper
6969
{
7070
case AtomicOperationCode.Add:
7171
{
72-
// ReSharper disable once MergeIntoPattern
73-
// Justification: Merging this into a pattern crashes the command-line versions of CleanupCode/InspectCode.
74-
// Tracked at: https://youtrack.jetbrains.com/issue/RSRP-486717
75-
if (atomicOperationObject.Ref != null && atomicOperationObject.Ref.Relationship == null)
72+
if (atomicOperationObject.Ref is { Relationship: null })
7673
{
7774
using IDisposable _ = state.Position.PushElement("ref");
7875
throw new ModelConversionException(state.Position, "The 'relationship' element is required.", null);

src/JsonApiDotNetCore/Serialization/Response/ResourceObjectTreeNode.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ public IList<ResourceObject> GetResponseIncluded()
187187

188188
private IList<ResourceObjectTreeNode> GetDirectChildren()
189189
{
190-
// ReSharper disable once MergeConditionalExpression
191-
// Justification: ReSharper reporting this is a bug, which is fixed in v2021.2.1. This condition cannot be merged.
192190
return _directChildren == null ? Array.Empty<ResourceObjectTreeNode>() : _directChildren;
193191
}
194192

test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/SoftDeletionTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Net.Http;
66
using System.Threading.Tasks;
77
using FluentAssertions;
8-
using FluentAssertions.Common;
98
using FluentAssertions.Extensions;
109
using JsonApiDotNetCore.Configuration;
1110
using JsonApiDotNetCore.Serialization.Objects;

test/SourceGeneratorTests/CompilationBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public CompilationBuilder WithSystemReferences()
3535
PortableExecutableReference systemRuntimeReference =
3636
MetadataReference.CreateFromFile(Path.Combine(Path.GetDirectoryName(objectLocation)!, "System.Runtime.dll"));
3737

38-
foreach (var reference in new[]
38+
foreach (PortableExecutableReference reference in new[]
3939
{
4040
MetadataReference.CreateFromFile(objectLocation),
4141
systemRuntimeReference
@@ -57,7 +57,7 @@ public CompilationBuilder WithLoggerFactoryReference()
5757

5858
public CompilationBuilder WithJsonApiDotNetCoreReferences()
5959
{
60-
foreach (var reference in new[]
60+
foreach (PortableExecutableReference reference in new[]
6161
{
6262
MetadataReference.CreateFromFile(typeof(ControllerBase).Assembly.Location),
6363
MetadataReference.CreateFromFile(typeof(AttrAttribute).Assembly.Location)

test/SourceGeneratorTests/SourceCodeBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public string Build()
1717

1818
if (_namespaceImports.Any())
1919
{
20-
foreach (var namespaceImport in _namespaceImports)
20+
foreach (string namespaceImport in _namespaceImports)
2121
{
2222
builder.AppendLine($"using {namespaceImport};");
2323
}

0 commit comments

Comments
 (0)