Skip to content

Commit 7f2c2b8

Browse files
committed
clean up, removed CPM, fixed errors, fixed releavant warnings, suppressed irrelevant warnings.
1 parent a70ae36 commit 7f2c2b8

49 files changed

Lines changed: 293 additions & 295 deletions

Some content is hidden

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

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Remove the line below if you want to inherit .editorconfig settings from higher directories
1+
# Remove the line below if you want to inherit .editorconfig settings from higher directories
22
root = true
33

44
# All files
@@ -131,7 +131,7 @@ csharp_prefer_simple_using_statement = false
131131
csharp_prefer_system_threading_lock = true
132132
csharp_style_namespace_declarations = file_scoped
133133
csharp_style_prefer_method_group_conversion = false
134-
csharp_style_prefer_primary_constructors = true
134+
csharp_style_prefer_primary_constructors = false
135135
csharp_style_prefer_top_level_statements = false
136136

137137
# Expression-level preferences

Directory.Build.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Roslynator.Analyzers" PrivateAssets="all" />
20-
<PackageReference Include="Meziantou.Analyzer" PrivateAssets="all" />
21-
<PackageReference Include="SonarAnalyzer.CSharp" PrivateAssets="all" />
22-
<PackageReference Include="SmartAnalyzers.ExceptionAnalyzer" PrivateAssets="all" />
19+
<PackageReference Include="Roslynator.Analyzers" Version="4.*" PrivateAssets="all" />
20+
<PackageReference Include="Meziantou.Analyzer" Version="3.*" PrivateAssets="all" />
21+
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.*" PrivateAssets="all" />
22+
<PackageReference Include="SmartAnalyzers.ExceptionAnalyzer" Version="1.*" PrivateAssets="all" />
2323
</ItemGroup>
2424

2525
</Project>

Directory.Packages.props

Lines changed: 0 additions & 25 deletions
This file was deleted.

PolylineAlgorithm.slnx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Solution>
22
<Folder Name="/.build/">
33
<File Path="Directory.Build.props" />
4-
<File Path="Directory.Packages.props" />
54
</Folder>
65
<Folder Name="/benchmarks/">
76
<Project Path="benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj" />

benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
</ItemGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="BenchmarkDotNet" />
23-
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" />
24-
<PackageReference Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" />
22+
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
23+
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.8" />
24+
<PackageReference Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="18.6.37110.2" />
2525
</ItemGroup>
2626

2727
<ItemGroup>

benchmarks/PolylineAlgorithm.Benchmarks/PolylineBenchmark.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class PolylineBenchmark {
2020
/// Number of coordinates for benchmarks. Set by BenchmarkDotNet.
2121
/// </summary>
2222
[Params(1, 100, 1_000)]
23-
public int CoordinatesCount;
23+
public int CoordinatesCount { get; set; }
2424

2525
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
2626
/// <summary>
@@ -54,7 +54,6 @@ public class PolylineBenchmark {
5454
/// and is used as the target buffer for copying polyline data during benchmark runs.
5555
/// </summary>
5656
public char[] CopyToDestination { get; private set; }
57-
5857
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
5958

6059

benchmarks/PolylineAlgorithm.Benchmarks/PolylineDecoderBenchmark.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class PolylineDecoderBenchmark {
1818
private readonly Consumer _consumer = new();
1919

2020
[Params(1, 100, 1_000)]
21-
public int CoordinatesCount;
21+
public int CoordinatesCount { get; set; }
2222

2323
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
2424
/// <summary>
@@ -46,7 +46,7 @@ public class PolylineDecoderBenchmark {
4646
/// <summary>
4747
/// Polyline decoder instance.
4848
/// </summary>
49-
public readonly PolylineDecoder Decoder = new();
49+
private readonly PolylineDecoder _decoder = new();
5050

5151
/// <summary>
5252
/// Sets up benchmark data.
@@ -64,7 +64,7 @@ public void SetupData() {
6464
/// </summary>
6565
[Benchmark]
6666
public void PolylineDecoder_Decode_Polyline() {
67-
Decoder
67+
_decoder
6868
.Decode(Polyline)
6969
.Consume(_consumer);
7070
}
@@ -74,7 +74,7 @@ public void PolylineDecoder_Decode_Polyline() {
7474
/// </summary>
7575
[Benchmark]
7676
public void PolylineDecoder_Decode_String() {
77-
Decoder
77+
_decoder
7878
.Decode(String)
7979
.Consume(_consumer);
8080
}
@@ -84,7 +84,7 @@ public void PolylineDecoder_Decode_String() {
8484
/// </summary>
8585
[Benchmark]
8686
public void PolylineDecoder_Decode_CharArray() {
87-
Decoder
87+
_decoder
8888
.Decode(CharArray)
8989
.Consume(_consumer);
9090
}
@@ -94,7 +94,7 @@ public void PolylineDecoder_Decode_CharArray() {
9494
/// </summary>
9595
[Benchmark]
9696
public void PolylineDecoder_Decode_Memory() {
97-
Decoder
97+
_decoder
9898
.Decode(Memory)
9999
.Consume(_consumer);
100100
}

benchmarks/PolylineAlgorithm.Benchmarks/PolylineEncoderBenchmark.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class PolylineEncoderBenchmark {
2222
/// Number of coordinates for benchmarks.
2323
/// </summary>
2424
[Params(1, 100, 1_000)]
25-
public int CoordinatesCount;
25+
public int CoordinatesCount { get; set; }
2626

2727
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
2828
/// <summary>
@@ -45,14 +45,14 @@ public class PolylineEncoderBenchmark {
4545
/// <summary>
4646
/// Polyline encoder instance.
4747
/// </summary>
48-
public readonly PolylineEncoder Encoder = new();
48+
private readonly PolylineEncoder _encoder = new();
4949

5050
/// <summary>
5151
/// Sets up benchmark data.
5252
/// </summary>
5353
[GlobalSetup]
5454
public void SetupData() {
55-
List = RandomValueProvider.GetCoordinates(CoordinatesCount).Select(c => new Coordinate(c.Latitude, c.Longitude)).ToList();
55+
List = [.. RandomValueProvider.GetCoordinates(CoordinatesCount).Select(c => new Coordinate(c.Latitude, c.Longitude))];
5656
Array = [.. List];
5757
Memory = Array.AsMemory();
5858
}
@@ -63,7 +63,7 @@ public void SetupData() {
6363
/// <returns>Encoded polyline.</returns>
6464
[Benchmark]
6565
public void PolylineEncoder_Encode_Span() {
66-
var polyline = Encoder
66+
var polyline = _encoder
6767
.Encode(Memory.Span!);
6868

6969
_consumer.Consume(polyline);
@@ -75,7 +75,7 @@ public void PolylineEncoder_Encode_Span() {
7575
/// <returns>Encoded polyline.</returns>
7676
[Benchmark]
7777
public void PolylineEncoder_Encode_Array() {
78-
var polyline = Encoder
78+
var polyline = _encoder
7979
.Encode(Array!);
8080

8181
_consumer.Consume(polyline);
@@ -87,7 +87,7 @@ public void PolylineEncoder_Encode_Array() {
8787
/// <returns>Encoded polyline.</returns>
8888
[Benchmark]
8989
public void PolylineEncoder_Encode_List() {
90-
var polyline = Encoder
90+
var polyline = _encoder
9191
.Encode(List!);
9292

9393
_consumer.Consume(polyline);

benchmarks/PolylineAlgorithm.Benchmarks/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace PolylineAlgorithm.Benchmarks;
1010
/// <summary>
1111
/// Main entry point for benchmarks.
1212
/// </summary>
13-
internal class Program {
13+
internal static class Program {
1414
/// <summary>
1515
/// Runs the benchmarks.
1616
/// </summary>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//
2+
// Copyright © Pete Sramek. All rights reserved.
3+
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
4+
//
5+
6+
using System.Diagnostics.CodeAnalysis;
7+
8+
[assembly: ExcludeFromCodeCoverage]

0 commit comments

Comments
 (0)