Skip to content

Commit b6e4cb8

Browse files
Merge pull request #15 from stefannikolei/sn/editorconfig
Sync editorconfig
2 parents 3b9a695 + 293e9a9 commit b6e4cb8

File tree

11 files changed

+30
-22
lines changed

11 files changed

+30
-22
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ csharp_style_deconstructed_variable_declaration = true:warning
161161
csharp_style_prefer_index_operator = true:warning
162162
csharp_style_prefer_range_operator = true:warning
163163
csharp_style_implicit_object_creation_when_type_is_apparent = true:error
164+
# ReSharper inspection severities
165+
resharper_arrange_object_creation_when_type_evident_highlighting = error
166+
resharper_arrange_object_creation_when_type_not_evident_highlighting = error
164167
# "Null" checking preferences
165168
csharp_style_throw_expression = true:warning
166169
csharp_style_conditional_delegate_call = true:warning
@@ -174,6 +177,11 @@ csharp_using_directive_placement = outside_namespace:warning
174177
csharp_prefer_static_local_function = true:warning
175178
# Primary constructor preferences
176179
csharp_style_prefer_primary_constructors = false:none
180+
# Collection preferences
181+
dotnet_style_prefer_collection_expression = true:error
182+
resharper_use_collection_expression_highlighting =true:error
183+
184+
177185

178186
##########################################
179187
# Unnecessary Code Rules

src/PolygonClipper/PolygonClipper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ private static bool TryTrivialOperationForEmptyPolygons(
253253
{
254254
if (operation == BooleanOperation.Intersection)
255255
{
256-
result = new();
256+
result = new Polygon();
257257
return true;
258258
}
259259

@@ -302,7 +302,7 @@ private static bool TryTrivialOperationForNonOverlappingBoundingBoxes(
302302
{
303303
if (operation == BooleanOperation.Intersection)
304304
{
305-
result = new();
305+
result = new Polygon();
306306
return true;
307307
}
308308

@@ -843,7 +843,7 @@ private static Polygon ConnectEdges(List<SweepEvent> sortedEvents, SweepEventCom
843843

844844
private static ReadOnlySpan<int> PrecomputeIterationOrder(List<SweepEvent> data)
845845
{
846-
Span<int> map = new Span<int>(new int[data.Count]);
846+
Span<int> map = new(new int[data.Count]);
847847

848848
int i = 0;
849849
while (i < data.Count)

tests/GeoJson/Converters/CrsConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public override object Read(
7070
{
7171
string? name = properties.GetProperty("name").GetString();
7272

73-
NamedCRS? target = new NamedCRS(name);
73+
NamedCRS? target = new(name);
7474
NamedCRS? converted = jObject.Deserialize<NamedCRS>();
7575

7676
if (converted.Properties != null)
@@ -90,7 +90,7 @@ public override object Read(
9090
{
9191
string? href = properties.GetProperty("href").GetString();
9292

93-
LinkedCRS? target = new LinkedCRS(href);
93+
LinkedCRS? target = new(href);
9494

9595
LinkedCRS? converted = jObject.Deserialize<LinkedCRS>();
9696

tests/GeoJson/Converters/FeatureConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace GeoJSON.Text.Converters
1515
/// </summary>
1616
public class FeatureConverter : JsonConverter<object>
1717
{
18-
private static readonly GeometryConverter geometryConverter = new GeometryConverter();
18+
private static readonly GeometryConverter geometryConverter = new();
1919
/// <summary>
2020
/// Determines whether this instance can convert the specified object type.
2121
/// </summary>

tests/GeoJson/Converters/GeometryEnumerableConverter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace GeoJSON.Text.Converters
1414
/// </summary>
1515
public class GeometryEnumerableConverter : JsonConverter<ReadOnlyCollection<IGeometryObject>>
1616
{
17-
private static readonly GeometryConverter GeometryConverter = new GeometryConverter();
17+
private static readonly GeometryConverter GeometryConverter = new();
1818

1919
/// <summary>
2020
/// Determines whether this instance can convert the specified object type.
@@ -52,7 +52,7 @@ public override ReadOnlyCollection<IGeometryObject> Read(
5252
}
5353

5454
int startDepth = reader.CurrentDepth;
55-
List<IGeometryObject>? result = new List<IGeometryObject>();
55+
List<IGeometryObject>? result = new();
5656
while (reader.Read())
5757
{
5858
if (JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)
@@ -90,4 +90,4 @@ public override void Write(
9090
writer.WriteEndArray();
9191
}
9292
}
93-
}
93+
}

tests/GeoJson/Converters/LineStringEnumerableConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace GeoJSON.Text.Converters
1414
/// </summary>
1515
public class LineStringEnumerableConverter : JsonConverter<IReadOnlyCollection<LineString>>
1616
{
17-
private static readonly PositionEnumerableConverter LineStringConverter = new PositionEnumerableConverter();
17+
private static readonly PositionEnumerableConverter LineStringConverter = new();
1818

1919
/// <summary>
2020
/// Determines whether this instance can convert the specified object type.
@@ -54,7 +54,7 @@ public override IReadOnlyCollection<LineString> Read(
5454
}
5555

5656
int startDepth = reader.CurrentDepth;
57-
List<LineString>? result = new List<LineString>();
57+
List<LineString>? result = new();
5858
while (reader.Read())
5959
{
6060
if(JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)

tests/GeoJson/Converters/PointEnumerableConverter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace GeoJSON.Text.Converters
1414
/// </summary>
1515
public class PointEnumerableConverter : JsonConverter<ReadOnlyCollection<Point>>
1616
{
17-
private static readonly PositionConverter PositionConverter = new PositionConverter();
17+
private static readonly PositionConverter PositionConverter = new();
1818
/// <inheritdoc />
1919
public override void Write(
2020
Utf8JsonWriter writer,
@@ -47,8 +47,8 @@ public override ReadOnlyCollection<Point> Read(
4747
}
4848

4949
int startDepth = reader.CurrentDepth;
50-
List<Point>? result = new List<Point>();
51-
List<double> numbers = new List<double>();
50+
List<Point>? result = new();
51+
List<double> numbers = new();
5252
while (reader.Read())
5353
{
5454
if (JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)

tests/GeoJson/Converters/PolygonEnumerableConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace GeoJSON.Text.Converters
1818
public class PolygonEnumerableConverter : JsonConverter<IReadOnlyCollection<Polygon>>
1919
{
2020

21-
private static readonly LineStringEnumerableConverter PolygonConverter = new LineStringEnumerableConverter();
21+
private static readonly LineStringEnumerableConverter PolygonConverter = new();
2222
/// <summary>
2323
/// Determines whether this instance can convert the specified object type.
2424
/// </summary>
@@ -58,7 +58,7 @@ public override IReadOnlyCollection<Polygon> Read(
5858
}
5959

6060
int startDepth = reader.CurrentDepth;
61-
List<Polygon>? result = new List<Polygon>();
61+
List<Polygon>? result = new();
6262
while (reader.Read())
6363
{
6464
if (JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)

tests/GeoJson/Converters/PositionEnumerableConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override IReadOnlyCollection<IPosition> Read(
5454
}
5555

5656
int startDepth = reader.CurrentDepth;
57-
List<IPosition>? result = new List<IPosition>();
57+
List<IPosition>? result = new();
5858
while (reader.Read())
5959
{
6060
if (JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)

tests/GeoJson/CoordinateReferenceSystem/DefaultCRS.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ private DefaultCRS()
2828
/// <value>
2929
/// The instance.
3030
/// </value>
31-
public static DefaultCRS Instance { get; } = new DefaultCRS();
31+
public static DefaultCRS Instance { get; } = new();
3232
}
3333
}

0 commit comments

Comments
 (0)