Skip to content

Commit 295c124

Browse files
committed
chore: Fix editorconfig-based warnings
(It can be hard to get these to show up without opening the code file itself. I've opened all files within VS, so we *should* be "clean" now.) Signed-off-by: Jon Skeet <[email protected]>
1 parent ae75b32 commit 295c124

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

samples/HttpSend/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Cloud Native Foundation.
1+
// Copyright (c) Cloud Native Foundation.
22
// Licensed under the Apache 2.0 license.
33
// See LICENSE file in the project root for full license information.
44

@@ -17,7 +17,7 @@ namespace HttpSend
1717
{
1818
// This application uses the McMaster.Extensions.CommandLineUtils library for parsing the command
1919
// line and calling the application code. The [Option] attributes designate the parameters.
20-
class Program
20+
internal class Program
2121
{
2222
[Option(Description = "CloudEvents 'source' (default: urn:example-com:mysource:abc)", LongName = "source", ShortName = "s")]
2323
private string Source { get; } = "urn:example-com:mysource:abc";
@@ -52,4 +52,4 @@ private async Task OnExecuteAsync()
5252
Console.WriteLine(result.StatusCode);
5353
}
5454
}
55-
}
55+
}

src/CloudNative.CloudEvents/CloudEventAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Cloud Native Foundation.
1+
// Copyright 2021 Cloud Native Foundation.
22
// Licensed under the Apache 2.0 license.
33
// See LICENSE file in the project root for full license information.
44

@@ -44,7 +44,7 @@ public class CloudEventAttribute
4444
/// </summary>
4545
public bool IsExtension { get; }
4646

47-
private Action<object>? validator;
47+
private readonly Action<object>? validator;
4848

4949
// TODO: Have a "mode" of Required/Optional/Extension?
5050

src/CloudNative.CloudEvents/CloudEventAttributeType.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Cloud Native Foundation.
1+
// Copyright 2021 Cloud Native Foundation.
22
// Licensed under the Apache 2.0 license.
33
// See LICENSE file in the project root for full license information.
44

@@ -105,16 +105,16 @@ protected GenericCloudEventsAttributeType(string name, CloudEventAttributeTypeOr
105105
{
106106
}
107107

108-
public override sealed object Parse(string value) => ParseImpl(Validation.CheckNotNull(value, nameof(value)));
108+
public sealed override object Parse(string value) => ParseImpl(Validation.CheckNotNull(value, nameof(value)));
109109

110-
public override sealed string Format(object value)
110+
public sealed override string Format(object value)
111111
{
112112
Validate(value);
113113
// TODO: Avoid the double cast.
114114
return FormatImpl((T) value);
115115
}
116116

117-
public override sealed void Validate(object value)
117+
public sealed override void Validate(object value)
118118
{
119119
Validation.CheckNotNull(value, nameof(value));
120120
if (!ClrType.IsInstanceOfType(value))

src/CloudNative.CloudEvents/CloudEventsSpecVersion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Cloud Native Foundation.
1+
// Copyright 2021 Cloud Native Foundation.
22
// Licensed under the Apache 2.0 license.
33
// See LICENSE file in the project root for full license information.
44

@@ -89,7 +89,7 @@ public sealed class CloudEventsSpecVersion
8989
/// </summary>
9090
public CloudEventAttribute TypeAttribute { get; }
9191

92-
private Dictionary<string, CloudEventAttribute> attributesByName;
92+
private readonly Dictionary<string, CloudEventAttribute> attributesByName;
9393

9494
// TODO: What's the compatibility story? What might be in 1.1, and how would we handle that in 1.0?
9595

src/CloudNative.CloudEvents/Core/BinaryDataUtilities.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Cloud Native Foundation.
1+
// Copyright 2021 Cloud Native Foundation.
22
// Licensed under the Apache 2.0 license.
33
// See LICENSE file in the project root for full license information.
44

@@ -22,7 +22,7 @@ public static class BinaryDataUtilities
2222
/// </summary>
2323
/// <param name="stream">The stream to read from. Must not be null.</param>
2424
/// <returns>The content of the stream (from its original position), as a read-only memory segment.</returns>
25-
public async static Task<ReadOnlyMemory<byte>> ToReadOnlyMemoryAsync(Stream stream)
25+
public static async Task<ReadOnlyMemory<byte>> ToReadOnlyMemoryAsync(Stream stream)
2626
{
2727
Validation.CheckNotNull(stream, nameof(stream));
2828
// TODO: Optimize if it's already a MemoryStream? Will only work in some cases,

src/CloudNative.CloudEvents/Http/HttpListenerExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Cloud Native Foundation.
1+
// Copyright 2021 Cloud Native Foundation.
22
// Licensed under the Apache 2.0 license.
33
// See LICENSE file in the project root for full license information.
44

@@ -138,7 +138,7 @@ public static Task<CloudEvent> ToCloudEventAsync(this HttpListenerRequest httpLi
138138
/// <param name="formatter">The event formatter to use to parse the CloudEvent. Must not be null.</param>
139139
/// <param name="extensionAttributes">The extension attributes to use when parsing the CloudEvent. May be null.</param>
140140
/// <returns>A reference to a validated CloudEvent instance.</returns>
141-
public async static Task<CloudEvent> ToCloudEventAsync(this HttpListenerRequest httpListenerRequest,
141+
public static async Task<CloudEvent> ToCloudEventAsync(this HttpListenerRequest httpListenerRequest,
142142
CloudEventFormatter formatter, IEnumerable<CloudEventAttribute>? extensionAttributes) =>
143143
await ToCloudEventAsyncImpl(httpListenerRequest, formatter, extensionAttributes, async: true).ConfigureAwait(false);
144144

@@ -164,7 +164,7 @@ public static CloudEvent ToCloudEvent(this HttpListenerRequest httpListenerReque
164164
CloudEventFormatter formatter, IEnumerable<CloudEventAttribute>? extensionAttributes) =>
165165
ToCloudEventAsyncImpl(httpListenerRequest, formatter, extensionAttributes, async: false).GetAwaiter().GetResult();
166166

167-
private async static Task<CloudEvent> ToCloudEventAsyncImpl(HttpListenerRequest httpListenerRequest,
167+
private static async Task<CloudEvent> ToCloudEventAsyncImpl(HttpListenerRequest httpListenerRequest,
168168
CloudEventFormatter formatter, IEnumerable<CloudEventAttribute>? extensionAttributes, bool async)
169169
{
170170
Validation.CheckNotNull(httpListenerRequest, nameof(httpListenerRequest));
@@ -264,7 +264,7 @@ public static IReadOnlyList<CloudEvent> ToCloudEventBatch(
264264
IEnumerable<CloudEventAttribute>? extensionAttributes) =>
265265
ToCloudEventBatchInternalAsync(httpListenerRequest, formatter, extensionAttributes, async: false).GetAwaiter().GetResult();
266266

267-
private async static Task<IReadOnlyList<CloudEvent>> ToCloudEventBatchInternalAsync(HttpListenerRequest httpListenerRequest,
267+
private static async Task<IReadOnlyList<CloudEvent>> ToCloudEventBatchInternalAsync(HttpListenerRequest httpListenerRequest,
268268
CloudEventFormatter formatter, IEnumerable<CloudEventAttribute>? extensionAttributes, bool async)
269269
{
270270
Validation.CheckNotNull(httpListenerRequest, nameof(httpListenerRequest));

test/CloudNative.CloudEvents.UnitTests/ConformanceTestData/SampleBatches.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 Cloud Native Foundation.
1+
// Copyright 2023 Cloud Native Foundation.
22
// Licensed under the Apache 2.0 license.
33
// See LICENSE file in the project root for full license information.
44

@@ -11,7 +11,7 @@ namespace CloudNative.CloudEvents.UnitTests.ConformanceTestData;
1111

1212
public static class SampleBatches
1313
{
14-
private static ConcurrentDictionary<string, IReadOnlyList<CloudEvent>> batchesById = new ConcurrentDictionary<string, IReadOnlyList<CloudEvent>>();
14+
private static readonly ConcurrentDictionary<string, IReadOnlyList<CloudEvent>> batchesById = new ConcurrentDictionary<string, IReadOnlyList<CloudEvent>>();
1515

1616
private static readonly IReadOnlyList<CloudEvent> empty = Register("empty");
1717
private static readonly IReadOnlyList<CloudEvent> minimal = Register("minimal", SampleEvents.Minimal);

test/CloudNative.CloudEvents.UnitTests/ConformanceTestData/SampleEvents.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 Cloud Native Foundation.
1+
// Copyright 2023 Cloud Native Foundation.
22
// Licensed under the Apache 2.0 license.
33
// See LICENSE file in the project root for full license information.
44

@@ -10,9 +10,9 @@ namespace CloudNative.CloudEvents.UnitTests.ConformanceTestData;
1010

1111
internal static class SampleEvents
1212
{
13-
private static ConcurrentDictionary<string, CloudEvent> eventsById = new ConcurrentDictionary<string, CloudEvent>();
13+
private static readonly ConcurrentDictionary<string, CloudEvent> eventsById = new ConcurrentDictionary<string, CloudEvent>();
1414

15-
private static IReadOnlyList<CloudEventAttribute> allExtensionAttributes = new List<CloudEventAttribute>()
15+
private static readonly IReadOnlyList<CloudEventAttribute> allExtensionAttributes = new List<CloudEventAttribute>()
1616
{
1717
CloudEventAttribute.CreateExtension("extinteger", CloudEventAttributeType.Integer),
1818
CloudEventAttribute.CreateExtension("extboolean", CloudEventAttributeType.Boolean),

test/CloudNative.CloudEvents.UnitTests/TimestampsTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Cloud Native Foundation.
1+
// Copyright 2021 Cloud Native Foundation.
22
// Licensed under the Apache 2.0 license.
33
// See LICENSE file in the project root for full license information.
44

@@ -79,7 +79,7 @@ public void Parse_Success_VaryingUtcOffset(string offsetPart, int expectedOffset
7979
AssertParseSuccess(expected, text);
8080
}
8181

82-
static void AssertParseSuccess(DateTimeOffset expected, string text)
82+
private static void AssertParseSuccess(DateTimeOffset expected, string text)
8383
{
8484
var parsed = Timestamps.Parse(text);
8585
AssertTimestampsEqual(expected, parsed);

0 commit comments

Comments
 (0)