Skip to content

Commit 55740da

Browse files
committed
Bump .editorconfig & use file scoped namespaces
1 parent 2f222a6 commit 55740da

File tree

96 files changed

+11345
-11443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+11345
-11443
lines changed

.editorconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Version: 3.0.0 (Using https://semver.org/)
2-
# Updated: 2021-08-09
1+
# Version: 4.0.0 (Using https://semver.org/)
2+
# Updated: 2021-10-12
33
# See https://github.com/RehanSaeed/EditorConfig/releases for release notes.
44
# See https://github.com/RehanSaeed/EditorConfig for updates to this file.
55
# See http://EditorConfig.org for more information about .editorconfig files.
@@ -167,6 +167,8 @@ dotnet_diagnostic.IDE0063.severity = suggestion
167167
csharp_using_directive_placement = inside_namespace:warning
168168
# Modifier preferences
169169
csharp_prefer_static_local_function = true:warning
170+
# Undocumented
171+
csharp_style_namespace_declarations = file_scoped:warning
170172

171173
##########################################
172174
# Unnecessary Code Rules

Benchmarks/Schema.NET.Benchmarks/Core/BookBenchmark.cs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
namespace Schema.NET.Benchmarks.Core
2-
{
3-
using System;
4-
using System.Collections.Generic;
1+
namespace Schema.NET.Benchmarks.Core;
2+
3+
using System;
4+
using System.Collections.Generic;
55

6-
public class BookBenchmark : SchemaBenchmarkBase
7-
{
8-
public override Thing InitialiseThing() =>
9-
new Book()
6+
public class BookBenchmark : SchemaBenchmarkBase
7+
{
8+
public override Thing InitialiseThing() =>
9+
new Book()
10+
{
11+
Id = new Uri("https://example.com/book/1"),
12+
Name = "The Catcher in the Rye",
13+
Author = new Person()
14+
{
15+
Name = "J.D. Salinger",
16+
},
17+
Url = new Uri("https://www.barnesandnoble.com/store/info/offer/JDSalinger"),
18+
WorkExample = new List<ICreativeWork>()
1019
{
11-
Id = new Uri("https://example.com/book/1"),
12-
Name = "The Catcher in the Rye",
13-
Author = new Person()
14-
{
15-
Name = "J.D. Salinger",
16-
},
17-
Url = new Uri("https://www.barnesandnoble.com/store/info/offer/JDSalinger"),
18-
WorkExample = new List<ICreativeWork>()
19-
{
2020
new Book()
2121
{
2222
Isbn = "031676948",
@@ -75,7 +75,6 @@ public override Thing InitialiseThing() =>
7575
},
7676
},
7777
},
78-
},
79-
};
80-
}
78+
},
79+
};
8180
}
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
namespace Schema.NET.Benchmarks.Core
2-
{
3-
using System;
1+
namespace Schema.NET.Benchmarks.Core;
2+
3+
using System;
44

5-
public class WebsiteBenchmark : SchemaBenchmarkBase
6-
{
7-
public override Thing InitialiseThing() =>
8-
new WebSite()
5+
public class WebsiteBenchmark : SchemaBenchmarkBase
6+
{
7+
public override Thing InitialiseThing() =>
8+
new WebSite()
9+
{
10+
PotentialAction = new SearchAction()
911
{
10-
PotentialAction = new SearchAction()
11-
{
12-
Target = new Uri("https://example.com/search?&q={query}"),
13-
QueryInput = "required",
14-
},
15-
Url = new Uri("https://example.com"),
16-
};
17-
}
12+
Target = new Uri("https://example.com/search?&q={query}"),
13+
QueryInput = "required",
14+
},
15+
Url = new Uri("https://example.com"),
16+
};
1817
}
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
namespace Schema.NET.Benchmarks
2-
{
3-
using BenchmarkDotNet.Running;
1+
namespace Schema.NET.Benchmarks;
2+
3+
using BenchmarkDotNet.Running;
44

5-
public class Program
6-
{
7-
private static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
8-
}
5+
public class Program
6+
{
7+
private static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
98
}
Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
1-
namespace Schema.NET.Benchmarks
2-
{
3-
using System;
4-
using System.Text.Json;
5-
using BenchmarkDotNet.Attributes;
6-
using BenchmarkDotNet.Jobs;
7-
8-
[KeepBenchmarkFiles]
9-
[MemoryDiagnoser]
10-
[MinColumn]
11-
[MaxColumn]
12-
[HtmlExporter]
13-
[CsvMeasurementsExporter]
14-
[RPlotExporter]
15-
[SimpleJob(RuntimeMoniker.Net60)]
16-
[SimpleJob(RuntimeMoniker.Net472)]
17-
public abstract class SchemaBenchmarkBase
18-
{
19-
public Thing Thing { get; set; } = default!;
1+
namespace Schema.NET.Benchmarks;
202

21-
private Type ThingType { get; set; } = default!;
3+
using System;
4+
using System.Text.Json;
5+
using BenchmarkDotNet.Attributes;
6+
using BenchmarkDotNet.Jobs;
227

23-
private string SerializedThing { get; set; } = default!;
8+
[KeepBenchmarkFiles]
9+
[MemoryDiagnoser]
10+
[MinColumn]
11+
[MaxColumn]
12+
[HtmlExporter]
13+
[CsvMeasurementsExporter]
14+
[RPlotExporter]
15+
[SimpleJob(RuntimeMoniker.Net60)]
16+
[SimpleJob(RuntimeMoniker.Net472)]
17+
public abstract class SchemaBenchmarkBase
18+
{
19+
public Thing Thing { get; set; } = default!;
2420

25-
public abstract Thing InitialiseThing();
21+
private Type ThingType { get; set; } = default!;
2622

27-
[GlobalSetup]
28-
public virtual void Setup()
29-
{
30-
this.Thing = this.InitialiseThing();
31-
this.ThingType = this.Thing.GetType();
32-
this.SerializedThing = this.Thing.ToString();
33-
}
23+
private string SerializedThing { get; set; } = default!;
3424

35-
[Benchmark]
36-
public string Serialize() => this.Thing.ToString();
25+
public abstract Thing InitialiseThing();
3726

38-
[Benchmark]
39-
public object? Deserialize() => JsonSerializer.Deserialize(this.SerializedThing, this.ThingType);
27+
[GlobalSetup]
28+
public virtual void Setup()
29+
{
30+
this.Thing = this.InitialiseThing();
31+
this.ThingType = this.Thing.GetType();
32+
this.SerializedThing = this.Thing.ToString();
4033
}
34+
35+
[Benchmark]
36+
public string Serialize() => this.Thing.ToString();
37+
38+
[Benchmark]
39+
public object? Deserialize() => JsonSerializer.Deserialize(this.SerializedThing, this.ThingType);
4140
}

Source/Common/Constants.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
namespace Schema.NET
1+
namespace Schema.NET;
2+
3+
/// <summary>
4+
/// Various constants for use within Schema.NET
5+
/// </summary>
6+
public static class Constants
27
{
38
/// <summary>
4-
/// Various constants for use within Schema.NET
9+
/// The HTTPS URL for Schema.org, excluding trailing slash.
510
/// </summary>
6-
public static class Constants
7-
{
8-
/// <summary>
9-
/// The HTTPS URL for Schema.org, excluding trailing slash.
10-
/// </summary>
11-
public const string HttpsSchemaOrgUrl = "https://schema.org";
11+
public const string HttpsSchemaOrgUrl = "https://schema.org";
1212

13-
/// <summary>
14-
/// The HTTP URL for Schema.org, excluding trailing slash.
15-
/// </summary>
16-
public const string HttpSchemaOrgUrl = "http://schema.org";
17-
}
13+
/// <summary>
14+
/// The HTTP URL for Schema.org, excluding trailing slash.
15+
/// </summary>
16+
public const string HttpSchemaOrgUrl = "http://schema.org";
1817
}

Source/Common/ContactType.cs

Lines changed: 59 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,62 @@
1-
namespace Schema.NET
1+
namespace Schema.NET;
2+
3+
/// <summary>
4+
/// The standard contact types defined by Google Structured Data.
5+
/// </summary>
6+
public static class ContactType
27
{
38
/// <summary>
4-
/// The standard contact types defined by Google Structured Data.
5-
/// </summary>
6-
public static class ContactType
7-
{
8-
/// <summary>
9-
/// The customer support contact type.
10-
/// </summary>
11-
public const string CustomerSupport = "customer support";
12-
13-
/// <summary>
14-
/// The technical support contact type.
15-
/// </summary>
16-
public const string TechnicalSupport = "technical support";
17-
18-
/// <summary>
19-
/// The billing support contact type.
20-
/// </summary>
21-
public const string BillingSupport = "billing support";
22-
23-
/// <summary>
24-
/// The bill payment contact type.
25-
/// </summary>
26-
public const string BillPayment = "bill payment";
27-
28-
/// <summary>
29-
/// The sales contact type.
30-
/// </summary>
31-
public const string Sales = "sales";
32-
33-
/// <summary>
34-
/// The reservations contact type.
35-
/// </summary>
36-
public const string Reservations = "reservations";
37-
38-
/// <summary>
39-
/// The credit card support contact type.
40-
/// </summary>
41-
public const string CreditCardSupport = "credit card support";
42-
43-
/// <summary>
44-
/// The emergency contact type.
45-
/// </summary>
46-
public const string Emergency = "emergency";
47-
48-
/// <summary>
49-
/// The baggage tracking contact type.
50-
/// </summary>
51-
public const string BaggageTracking = "baggage tracking";
52-
53-
/// <summary>
54-
/// The roadside assistance contact type.
55-
/// </summary>
56-
public const string RoadsideAssistance = "roadside assistance";
57-
58-
/// <summary>
59-
/// The package tracking contact type.
60-
/// </summary>
61-
public const string PackageTracking = "package tracking";
62-
}
9+
/// The customer support contact type.
10+
/// </summary>
11+
public const string CustomerSupport = "customer support";
12+
13+
/// <summary>
14+
/// The technical support contact type.
15+
/// </summary>
16+
public const string TechnicalSupport = "technical support";
17+
18+
/// <summary>
19+
/// The billing support contact type.
20+
/// </summary>
21+
public const string BillingSupport = "billing support";
22+
23+
/// <summary>
24+
/// The bill payment contact type.
25+
/// </summary>
26+
public const string BillPayment = "bill payment";
27+
28+
/// <summary>
29+
/// The sales contact type.
30+
/// </summary>
31+
public const string Sales = "sales";
32+
33+
/// <summary>
34+
/// The reservations contact type.
35+
/// </summary>
36+
public const string Reservations = "reservations";
37+
38+
/// <summary>
39+
/// The credit card support contact type.
40+
/// </summary>
41+
public const string CreditCardSupport = "credit card support";
42+
43+
/// <summary>
44+
/// The emergency contact type.
45+
/// </summary>
46+
public const string Emergency = "emergency";
47+
48+
/// <summary>
49+
/// The baggage tracking contact type.
50+
/// </summary>
51+
public const string BaggageTracking = "baggage tracking";
52+
53+
/// <summary>
54+
/// The roadside assistance contact type.
55+
/// </summary>
56+
public const string RoadsideAssistance = "roadside assistance";
57+
58+
/// <summary>
59+
/// The package tracking contact type.
60+
/// </summary>
61+
public const string PackageTracking = "package tracking";
6362
}

0 commit comments

Comments
 (0)