Skip to content

Commit ae75b32

Browse files
committed
chore: Fix whitespace in all files
These changes were generated automatically by running "Analyze and Code Cleanup". Showing a diff ignoring whitespace shows the removal of the UTF-8 BOM from three files, but that's all. Signed-off-by: Jon Skeet <[email protected]>
1 parent b04c141 commit ae75b32

37 files changed

+104
-104
lines changed

samples/HttpSend/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Program
2525
[Option(Description = "CloudEvents 'type' (default: com.example.myevent)", LongName = "type", ShortName = "t")]
2626
private string Type { get; } = "com.example.myevent";
2727

28-
[Required,Option(Description = "HTTP(S) address to send the event to", LongName = "url", ShortName = "u"),]
28+
[Required, Option(Description = "HTTP(S) address to send the event to", LongName = "url", ShortName = "u"),]
2929
private Uri Url { get; }
3030

3131
public static int Main(string[] args) => CommandLineApplication.Execute<Program>(args);

src/CloudNative.CloudEvents.Avro/AvroEventFormatter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private CloudEvent DecodeGenericRecord(GenericRecord record, IEnumerable<CloudEv
9292
{
9393
throw new ArgumentException($"Record has no '{AttributeName}' field");
9494
}
95-
IDictionary<string, object> recordAttributes = (IDictionary<string, object>)attrObj;
95+
IDictionary<string, object> recordAttributes = (IDictionary<string, object>) attrObj;
9696

9797
if (!recordAttributes.TryGetValue(CloudEventsSpecVersion.SpecVersionAttribute.Name, out var versionId) ||
9898
!(versionId is string versionIdString))
@@ -131,7 +131,7 @@ private CloudEvent DecodeGenericRecord(GenericRecord record, IEnumerable<CloudEv
131131
}
132132
else if (value is string)
133133
{
134-
cloudEvent.SetAttributeFromString(key, (string)value);
134+
cloudEvent.SetAttributeFromString(key, (string) value);
135135
}
136136
else
137137
{

src/CloudNative.CloudEvents.NewtonsoftJson/JsonEventFormatter.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private CloudEvent DecodeJObject(JObject jObject, IEnumerable<CloudEventAttribut
211211
throw new ArgumentException($"Structured mode content does not represent a CloudEvent");
212212
}
213213
var specVersion = CloudEventsSpecVersion.FromVersionId((string?) specVersionToken)
214-
?? throw new ArgumentException($"Unsupported CloudEvents spec version '{(string?)specVersionToken}'");
214+
?? throw new ArgumentException($"Unsupported CloudEvents spec version '{(string?) specVersionToken}'");
215215

216216
var cloudEvent = new CloudEvent(specVersion, extensionAttributes);
217217
PopulateAttributesFromStructuredEvent(cloudEvent, jObject);
@@ -247,10 +247,10 @@ private void PopulateAttributesFromStructuredEvent(CloudEvent cloudEvent, JObjec
247247

248248
string? attributeValue = value.Type switch
249249
{
250-
JTokenType.String => (string?)value,
251-
JTokenType.Boolean => CloudEventAttributeType.Boolean.Format((bool)value),
250+
JTokenType.String => (string?) value,
251+
JTokenType.Boolean => CloudEventAttributeType.Boolean.Format((bool) value),
252252
JTokenType.Null => null,
253-
JTokenType.Integer => CloudEventAttributeType.Integer.Format((int)value),
253+
JTokenType.Integer => CloudEventAttributeType.Integer.Format((int) value),
254254
_ => throw new ArgumentException($"Invalid token type '{value.Type}' for CloudEvent attribute")
255255
};
256256
if (attributeValue is null)
@@ -345,7 +345,7 @@ protected virtual void DecodeStructuredModeDataBase64Property(JToken dataBase64T
345345
{
346346
throw new ArgumentException($"Structured mode property '{DataBase64PropertyName}' must be a string, when present.");
347347
}
348-
cloudEvent.Data = Convert.FromBase64String((string?)dataBase64Token);
348+
cloudEvent.Data = Convert.FromBase64String((string?) dataBase64Token);
349349
}
350350

351351
/// <summary>
@@ -696,7 +696,7 @@ public override void DecodeBinaryModeEventData(ReadOnlyMemory<byte> body, CloudE
696696
/// <inheritdoc />
697697
protected override void EncodeStructuredModeData(CloudEvent cloudEvent, JsonWriter writer)
698698
{
699-
T data = (T)cloudEvent.Data;
699+
T data = (T) cloudEvent.Data;
700700
writer.WritePropertyName(DataPropertyName);
701701
Serializer.Serialize(writer, data);
702702
}

src/CloudNative.CloudEvents.Protobuf/ProtobufEventFormatter.cs

Lines changed: 3 additions & 3 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

@@ -229,7 +229,7 @@ private CloudEvent ConvertFromProto(V1.CloudEvent proto, IEnumerable<CloudEventA
229229
// Note: impossible to cover in tests
230230
throw new ArgumentException($"Unhandled protobuf attribute case: {pair.Value.AttrCase}", paramName);
231231
}
232-
232+
233233
// If we've already got an extension attribute specified for this name,
234234
// we validate against it and require the value in the proto to have the right
235235
// type. Otherwise, we create a new extension attribute of the correct type.
@@ -254,7 +254,7 @@ private CloudEvent ConvertFromProto(V1.CloudEvent proto, IEnumerable<CloudEventA
254254
throw new ArgumentException(
255255
$"Attribute '{attr.Name}' was specified with type '{attr.Type}', but has type '{attrTypeFromProto}' in the protobuf representation.");
256256
}
257-
257+
258258
// Note: the indexer performs validation.
259259
cloudEvent[attr] = pair.Value.AttrCase switch
260260
{

src/CloudNative.CloudEvents.SystemTextJson/JsonEventFormatter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ private void PopulateDataFromStructuredEvent(CloudEvent cloudEvent, JsonElement
331331
{
332332
// If no content type has been specified, default to application/json
333333
cloudEvent.DataContentType ??= JsonMediaType;
334-
334+
335335
DecodeStructuredModeDataProperty(dataElement, cloudEvent);
336336
}
337337
}
@@ -677,7 +677,7 @@ public override ReadOnlyMemory<byte> EncodeBinaryModeEventData(CloudEvent cloudE
677677
{
678678
return Array.Empty<byte>();
679679
}
680-
T data = (T)cloudEvent.Data;
680+
T data = (T) cloudEvent.Data;
681681
return JsonSerializer.SerializeToUtf8Bytes(data, SerializerOptions);
682682
}
683683

@@ -697,7 +697,7 @@ public override void DecodeBinaryModeEventData(ReadOnlyMemory<byte> body, CloudE
697697
/// <inheritdoc />
698698
protected override void EncodeStructuredModeData(CloudEvent cloudEvent, Utf8JsonWriter writer)
699699
{
700-
T data = (T)cloudEvent.Data;
700+
T data = (T) cloudEvent.Data;
701701
writer.WritePropertyName(DataPropertyName);
702702
JsonSerializer.Serialize(writer, data, SerializerOptions);
703703
}

src/CloudNative.CloudEvents/CloudEvent.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public object? this[string attributeName]
183183
Validation.CheckNotNull(attributeName, nameof(attributeName));
184184
Validation.CheckArgument(attributeName != CloudEventsSpecVersion.SpecVersionAttributeName, nameof(attributeName), () => Strings.ErrorCannotIndexBySpecVersionAttribute);
185185
return attributeValues.GetValueOrDefault(Validation.CheckNotNull(attributeName, nameof(attributeName)));
186-
}
186+
}
187187
set
188188
{
189189
Validation.CheckNotNull(attributeName, nameof(attributeName));
@@ -229,7 +229,7 @@ public object? this[string attributeName]
229229
public string? DataContentType
230230
{
231231
// TODO: Guard against a version that doesn't have this attribute?
232-
get => (string?)this[SpecVersion.DataContentTypeAttribute];
232+
get => (string?) this[SpecVersion.DataContentTypeAttribute];
233233
set => this[SpecVersion.DataContentTypeAttribute] = value;
234234
}
235235

@@ -239,7 +239,7 @@ public string? DataContentType
239239
/// </summary>
240240
public string? Id
241241
{
242-
get => (string?)this[SpecVersion.IdAttribute];
242+
get => (string?) this[SpecVersion.IdAttribute];
243243
set => this[SpecVersion.IdAttribute] = value;
244244
}
245245

@@ -250,7 +250,7 @@ public string? Id
250250
/// </summary>
251251
public Uri? DataSchema
252252
{
253-
get => (Uri?)this[SpecVersion.DataSchemaAttribute];
253+
get => (Uri?) this[SpecVersion.DataSchemaAttribute];
254254
set => this[SpecVersion.DataSchemaAttribute] = value;
255255
}
256256

@@ -262,7 +262,7 @@ public Uri? DataSchema
262262
/// </summary>
263263
public Uri? Source
264264
{
265-
get => (Uri?)this[SpecVersion.SourceAttribute];
265+
get => (Uri?) this[SpecVersion.SourceAttribute];
266266
set => this[SpecVersion.SourceAttribute] = value;
267267
}
268268

@@ -280,7 +280,7 @@ public Uri? Source
280280
/// </summary>
281281
public string? Subject
282282
{
283-
get => (string?)this[SpecVersion.SubjectAttribute];
283+
get => (string?) this[SpecVersion.SubjectAttribute];
284284
set => this[SpecVersion.SubjectAttribute] = value;
285285
}
286286

@@ -290,7 +290,7 @@ public string? Subject
290290
/// </summary>
291291
public DateTimeOffset? Time
292292
{
293-
get => (DateTimeOffset?)this[SpecVersion.TimeAttribute];
293+
get => (DateTimeOffset?) this[SpecVersion.TimeAttribute];
294294
set => this[SpecVersion.TimeAttribute] = value;
295295
}
296296

@@ -301,7 +301,7 @@ public DateTimeOffset? Time
301301
/// </summary>
302302
public string? Type
303303
{
304-
get => (string?)this[SpecVersion.TypeAttribute];
304+
get => (string?) this[SpecVersion.TypeAttribute];
305305
set => this[SpecVersion.TypeAttribute] = value;
306306
}
307307

src/CloudNative.CloudEvents/CloudEventAttributeType.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public override sealed void Validate(object value)
122122
throw new ArgumentException($"Value of type {value.GetType()} is incompatible with expected type {ClrType}", nameof(value));
123123
}
124124

125-
ValidateImpl((T)Validation.CheckNotNull(value, nameof(value)));
125+
ValidateImpl((T) Validation.CheckNotNull(value, nameof(value)));
126126
}
127127

128128
protected abstract T ParseImpl(string value);
@@ -168,12 +168,12 @@ protected override void ValidateImpl(string value)
168168
// Directly from the spec
169169
if (c <= 0x1f || (c >= 0x7f && c <= 0x9f))
170170
{
171-
throw new ArgumentException($"Control character U+{(ushort)c:x4} is not permitted in string attributes");
171+
throw new ArgumentException($"Control character U+{(ushort) c:x4} is not permitted in string attributes");
172172
}
173173
// First two ranges in http://www.unicode.org/faq/private_use.html#noncharacters
174174
if (c >= 0xfffe || (c >= 0xfdd0 && c <= 0xfdef))
175175
{
176-
throw new ArgumentException($"Noncharacter U+{(ushort)c:x4} is not permitted in string attributes");
176+
throw new ArgumentException($"Noncharacter U+{(ushort) c:x4} is not permitted in string attributes");
177177
}
178178

179179
// Handle surrogate pairs, based on this character and whether the last character was a high surrogate.
@@ -185,15 +185,15 @@ protected override void ValidateImpl(string value)
185185
{
186186
if (lastCharWasHighSurrogate)
187187
{
188-
throw new ArgumentException($"High surrogate character U+{(ushort)value[i - 1]:x4} must be followed by a low surrogate character");
188+
throw new ArgumentException($"High surrogate character U+{(ushort) value[i - 1]:x4} must be followed by a low surrogate character");
189189
}
190190
lastCharWasHighSurrogate = true;
191191
}
192192
else
193193
{
194194
if (!lastCharWasHighSurrogate)
195195
{
196-
throw new ArgumentException($"Low surrogate character U+{(ushort)c:x4} must be preceded by a high surrogate character");
196+
throw new ArgumentException($"Low surrogate character U+{(ushort) c:x4} must be preceded by a high surrogate character");
197197
}
198198
// Convert the surrogate pair to validate it's not a non-character.
199199
// This is the third rule in http://www.unicode.org/faq/private_use.html#noncharacters
@@ -208,12 +208,12 @@ protected override void ValidateImpl(string value)
208208
}
209209
else if (lastCharWasHighSurrogate)
210210
{
211-
throw new ArgumentException($"High surrogate character U+{(ushort)value[i - 1]:x4} must be followed by a low surrogate character");
211+
throw new ArgumentException($"High surrogate character U+{(ushort) value[i - 1]:x4} must be followed by a low surrogate character");
212212
}
213213
}
214214
if (lastCharWasHighSurrogate)
215215
{
216-
throw new ArgumentException($"String must not end with high surrogate character U+{(ushort)value[value.Length - 1]:x4}");
216+
throw new ArgumentException($"String must not end with high surrogate character U+{(ushort) value[value.Length - 1]:x4}");
217217
}
218218
}
219219
}

src/CloudNative.CloudEvents/CloudEventFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public virtual async Task<IReadOnlyList<CloudEvent>> DecodeBatchModeMessageAsync
185185
/// <param name="cloudEvent">The CloudEvent to get or infer the data content type from. Must not be null.</param>
186186
/// <returns>The data content type of the CloudEvent, or null for no data content type.</returns>
187187
public virtual string? GetOrInferDataContentType(CloudEvent cloudEvent)
188-
{
188+
{
189189
Validation.CheckNotNull(cloudEvent, nameof(cloudEvent));
190190
return cloudEvent.DataContentType is string dataContentType ? dataContentType
191191
: cloudEvent.Data is not object data ? null

src/CloudNative.CloudEvents/CloudEventFormatterAttribute.cs

Lines changed: 3 additions & 3 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

@@ -73,6 +73,6 @@ public CloudEventFormatterAttribute(Type formatterType) =>
7373
}
7474

7575
return formatter;
76+
}
7677
}
77-
}
78-
}
78+
}

src/CloudNative.CloudEvents/CloudEventsSpecVersion.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public sealed class CloudEventsSpecVersion
9898
/// or null if no such version is known.
9999
/// </summary>
100100
/// <param name="versionId">The version ID to check. May be null, in which case the result will be null.</param>
101-
[return:NotNullIfNotNull(nameof(VersionId))]
101+
[return: NotNullIfNotNull(nameof(VersionId))]
102102
public static CloudEventsSpecVersion? FromVersionId(string? versionId) =>
103103
allVersions.FirstOrDefault(version => version.VersionId == versionId);
104104

@@ -159,7 +159,7 @@ private CloudEventsSpecVersion(
159159

160160
private static void NonEmptyString(object value)
161161
{
162-
string text = (string)value;
162+
string text = (string) value;
163163
if (text.Length == 0)
164164
{
165165
throw new ArgumentException("Value must be non-empty");
@@ -179,7 +179,7 @@ private static void Rfc2046String(object value)
179179
{
180180
try
181181
{
182-
_ = new ContentType((string)value);
182+
_ = new ContentType((string) value);
183183
}
184184
catch
185185
{

0 commit comments

Comments
 (0)