Skip to content

Commit

Permalink
chore: Fix editorconfig-based warnings
Browse files Browse the repository at this point in the history
(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 <jonskeet@google.com>
  • Loading branch information
jskeet committed Nov 14, 2023
1 parent ae75b32 commit 295c124
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions samples/HttpSend/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Cloud Native Foundation.
// Copyright (c) Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.

Expand All @@ -17,7 +17,7 @@ namespace HttpSend
{
// This application uses the McMaster.Extensions.CommandLineUtils library for parsing the command
// line and calling the application code. The [Option] attributes designate the parameters.
class Program
internal class Program
{
[Option(Description = "CloudEvents 'source' (default: urn:example-com:mysource:abc)", LongName = "source", ShortName = "s")]
private string Source { get; } = "urn:example-com:mysource:abc";
Expand Down Expand Up @@ -52,4 +52,4 @@ private async Task OnExecuteAsync()
Console.WriteLine(result.StatusCode);
}
}
}
}
4 changes: 2 additions & 2 deletions src/CloudNative.CloudEvents/CloudEventAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Cloud Native Foundation.
// Copyright 2021 Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.

Expand Down Expand Up @@ -44,7 +44,7 @@ public class CloudEventAttribute
/// </summary>
public bool IsExtension { get; }

private Action<object>? validator;
private readonly Action<object>? validator;

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

Expand Down
8 changes: 4 additions & 4 deletions src/CloudNative.CloudEvents/CloudEventAttributeType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Cloud Native Foundation.
// Copyright 2021 Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.

Expand Down Expand Up @@ -105,16 +105,16 @@ protected GenericCloudEventsAttributeType(string name, CloudEventAttributeTypeOr
{
}

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

public override sealed string Format(object value)
public sealed override string Format(object value)
{
Validate(value);
// TODO: Avoid the double cast.
return FormatImpl((T) value);
}

public override sealed void Validate(object value)
public sealed override void Validate(object value)
{
Validation.CheckNotNull(value, nameof(value));
if (!ClrType.IsInstanceOfType(value))
Expand Down
4 changes: 2 additions & 2 deletions src/CloudNative.CloudEvents/CloudEventsSpecVersion.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Cloud Native Foundation.
// Copyright 2021 Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.

Expand Down Expand Up @@ -89,7 +89,7 @@ public sealed class CloudEventsSpecVersion
/// </summary>
public CloudEventAttribute TypeAttribute { get; }

private Dictionary<string, CloudEventAttribute> attributesByName;
private readonly Dictionary<string, CloudEventAttribute> attributesByName;

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

Expand Down
4 changes: 2 additions & 2 deletions src/CloudNative.CloudEvents/Core/BinaryDataUtilities.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Cloud Native Foundation.
// Copyright 2021 Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.

Expand All @@ -22,7 +22,7 @@ public static class BinaryDataUtilities
/// </summary>
/// <param name="stream">The stream to read from. Must not be null.</param>
/// <returns>The content of the stream (from its original position), as a read-only memory segment.</returns>
public async static Task<ReadOnlyMemory<byte>> ToReadOnlyMemoryAsync(Stream stream)
public static async Task<ReadOnlyMemory<byte>> ToReadOnlyMemoryAsync(Stream stream)
{
Validation.CheckNotNull(stream, nameof(stream));
// TODO: Optimize if it's already a MemoryStream? Will only work in some cases,
Expand Down
8 changes: 4 additions & 4 deletions src/CloudNative.CloudEvents/Http/HttpListenerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Cloud Native Foundation.
// Copyright 2021 Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.

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

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

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

private async static Task<IReadOnlyList<CloudEvent>> ToCloudEventBatchInternalAsync(HttpListenerRequest httpListenerRequest,
private static async Task<IReadOnlyList<CloudEvent>> ToCloudEventBatchInternalAsync(HttpListenerRequest httpListenerRequest,
CloudEventFormatter formatter, IEnumerable<CloudEventAttribute>? extensionAttributes, bool async)
{
Validation.CheckNotNull(httpListenerRequest, nameof(httpListenerRequest));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Cloud Native Foundation.
// Copyright 2023 Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.

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

public static class SampleBatches
{
private static ConcurrentDictionary<string, IReadOnlyList<CloudEvent>> batchesById = new ConcurrentDictionary<string, IReadOnlyList<CloudEvent>>();
private static readonly ConcurrentDictionary<string, IReadOnlyList<CloudEvent>> batchesById = new ConcurrentDictionary<string, IReadOnlyList<CloudEvent>>();

private static readonly IReadOnlyList<CloudEvent> empty = Register("empty");
private static readonly IReadOnlyList<CloudEvent> minimal = Register("minimal", SampleEvents.Minimal);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Cloud Native Foundation.
// Copyright 2023 Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.

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

internal static class SampleEvents
{
private static ConcurrentDictionary<string, CloudEvent> eventsById = new ConcurrentDictionary<string, CloudEvent>();
private static readonly ConcurrentDictionary<string, CloudEvent> eventsById = new ConcurrentDictionary<string, CloudEvent>();

private static IReadOnlyList<CloudEventAttribute> allExtensionAttributes = new List<CloudEventAttribute>()
private static readonly IReadOnlyList<CloudEventAttribute> allExtensionAttributes = new List<CloudEventAttribute>()
{
CloudEventAttribute.CreateExtension("extinteger", CloudEventAttributeType.Integer),
CloudEventAttribute.CreateExtension("extboolean", CloudEventAttributeType.Boolean),
Expand Down
4 changes: 2 additions & 2 deletions test/CloudNative.CloudEvents.UnitTests/TimestampsTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Cloud Native Foundation.
// Copyright 2021 Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.

Expand Down Expand Up @@ -79,7 +79,7 @@ public void Parse_Success_VaryingUtcOffset(string offsetPart, int expectedOffset
AssertParseSuccess(expected, text);
}

static void AssertParseSuccess(DateTimeOffset expected, string text)
private static void AssertParseSuccess(DateTimeOffset expected, string text)
{
var parsed = Timestamps.Parse(text);
AssertTimestampsEqual(expected, parsed);
Expand Down

0 comments on commit 295c124

Please sign in to comment.