Skip to content

Commit 37ac8f2

Browse files
Fix warnings
This commit disables the following warnings: - AV2310 (Code block should not contain inline comments) - AV2318 (Work-tracking TO DO comment should be removed) - AV2407 (Region should be removed) It should be allowed to add useful inline comments. In a pull request, there might be some TODOs. Regions can be useful to structure larger groups of methods, for example. Further, this commits makes code changes to remove other warnings.
1 parent c6db07d commit 37ac8f2

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/JsonApiDotNetCore/Queries/INoSqlQueryLayerComposer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ QueryLayer ComposeForGetByIdForNoSql<TId>(TId id, ResourceType primaryResourceTy
5353
/// <see langword="false" />, if the resource is a secondary resource (e.g., "/{primary}/{id}/{relationshipName}").
5454
/// </param>
5555
/// <returns>A tuple with a <see cref="QueryLayer" /> and an <see cref="IncludeExpression" />.</returns>
56-
(QueryLayer QueryLayer, IncludeExpression Include) ComposeFromConstraintsAndFilterForNoSql(
56+
(QueryLayer QueryLayer, IncludeExpression Include) ComposeFromConstraintsForNoSql(
5757
ResourceType requestResourceType,
5858
string propertyName,
5959
string propertyValue,

src/JsonApiDotNetCore/Queries/NoSqlQueryLayerComposer.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using JsonApiDotNetCore.Resources;
99
using JsonApiDotNetCore.Resources.Annotations;
1010

11+
#pragma warning disable AV2310 // Code block should not contain inline comment
12+
1113
namespace JsonApiDotNetCore.Queries
1214
{
1315
/// <summary>
@@ -90,14 +92,14 @@ public QueryLayer ComposeForGetByIdForNoSql<TId>(TId id, ResourceType primaryRes
9092
Filter = new ComparisonExpression(
9193
ComparisonOperator.Equals,
9294
new ResourceFieldChainExpression(
93-
primaryResourceType.Fields.Single(f => f.Property.Name == nameof(IIdentifiable<TId>.Id))),
95+
primaryResourceType.Fields.Single(field => field.Property.Name == nameof(IIdentifiable<TId>.Id))),
9496
new LiteralConstantExpression(id.ToString()!)),
9597
Include = IncludeExpression.Empty,
9698
};
9799
}
98100

99101
/// <inheritdoc />
100-
public (QueryLayer QueryLayer, IncludeExpression Include) ComposeFromConstraintsAndFilterForNoSql(
102+
public (QueryLayer QueryLayer, IncludeExpression Include) ComposeFromConstraintsForNoSql(
101103
ResourceType requestResourceType,
102104
string propertyName,
103105
string propertyValue,
@@ -161,7 +163,7 @@ private static FilterExpression ComposeSecondaryResourceFilter(
161163
{
162164
return new ComparisonExpression(
163165
ComparisonOperator.Equals,
164-
new ResourceFieldChainExpression(resourceType.Fields.Single(f => f.Property.Name == propertyName)),
166+
new ResourceFieldChainExpression(resourceType.Fields.Single(field => field.Property.Name == propertyName)),
165167
new LiteralConstantExpression(properyValue));
166168
}
167169

src/JsonApiDotNetCore/Services/NoSqlResourceService.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
using Microsoft.Extensions.Logging;
2121
using SysNotNull = System.Diagnostics.CodeAnalysis.NotNullAttribute;
2222

23+
#pragma warning disable AV2310 // Code block should not contain inline comment
24+
#pragma warning disable AV2318 // Work-tracking TO DO comment should be removed
25+
#pragma warning disable AV2407 // Region should be removed
26+
2327
namespace JsonApiDotNetCore.Services
2428
{
2529
/// <summary>
@@ -472,7 +476,7 @@ protected virtual async Task GetIncludedElementAsync(
472476
// Get the HasMany or HasOne attribute corresponding to the given relationship name.
473477
ResourceType resourceContext = _resourceGraph.GetResourceType(primaryResource.GetType());
474478
RelationshipAttribute? relationshipAttribute = resourceContext.Relationships
475-
.SingleOrDefault(r => r.PublicName == relationshipName);
479+
.SingleOrDefault(relationship => relationship.PublicName == relationshipName);
476480

477481
if (relationshipAttribute is null)
478482
{
@@ -593,7 +597,7 @@ protected async Task<IReadOnlyCollection<IIdentifiable>> GetManySecondaryResourc
593597
bool isIncluded,
594598
CancellationToken cancellationToken)
595599
{
596-
var (queryLayer, include) = _queryLayerComposer.ComposeFromConstraintsAndFilterForNoSql(
600+
var (queryLayer, include) = _queryLayerComposer.ComposeFromConstraintsForNoSql(
597601
resourceType, propertyName, propertyValue, isIncluded);
598602

599603
IReadOnlyCollection<IIdentifiable> items = await _repositoryAccessor.GetAsync(

0 commit comments

Comments
 (0)