diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
new file mode 100644
index 00000000..4b777901
--- /dev/null
+++ b/.config/dotnet-tools.json
@@ -0,0 +1,12 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "jetbrains.resharper.globaltools": {
+ "version": "2021.1.3",
+ "commands": [
+ "jb"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..31376257
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,29 @@
+[*.{csproj,json,targets}]
+indent_size = 2
+resharper_xml_wrap_tags_and_pi = false
+
+[*.cs]
+csharp_new_line_before_members_in_object_initializers = false
+csharp_preserve_single_line_blocks = true
+resharper_blank_lines_after_block_statements = 0
+resharper_blank_lines_around_auto_property = 0
+resharper_blank_lines_around_single_line_type = 0
+resharper_csharp_blank_lines_around_field = 0
+resharper_csharp_insert_final_newline = true
+resharper_csharp_wrap_lines = false
+resharper_empty_block_style = multiline
+resharper_keep_existing_embedded_block_arrangement = false
+resharper_keep_existing_enum_arrangement = false
+resharper_max_attribute_length_for_same_line = 70
+resharper_place_accessorholder_attribute_on_same_line = false
+resharper_place_expr_accessor_on_single_line = true
+resharper_place_expr_method_on_single_line = true
+resharper_place_expr_property_on_single_line = true
+resharper_place_field_attribute_on_same_line = false
+resharper_place_simple_embedded_statement_on_same_line = true
+resharper_place_simple_initializer_on_single_line = false
+resharper_remove_blank_lines_near_braces_in_code = false
+resharper_remove_blank_lines_near_braces_in_declarations = false
+resharper_wrap_array_initializer_style = chop_if_long
+resharper_wrap_chained_binary_expressions = chop_if_long
+resharper_wrap_object_and_collection_initializer_style = chop_always
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cc6eee06..1607274b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,6 +14,27 @@ jobs:
# Note that vcpkg dependencies takes the majority of the build time.
# We cache them using GitHub Actions cache and export, making the scripts below a bit more complex.
+ check-format:
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id
+ runs-on: ubuntu-18.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Setup .NET Core SDK
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: ${{ env.dotnet_5_version }}
+ - name: Code formating check
+ run: |
+ dotnet tool restore
+ dotnet jb cleanupcode "csharp" "csharp.test" "csharp.benchmark" --profile="Built-in: Reformat Code" --settings="ParquetSharp.DotSettings" --dotnetcoresdk=${{ env.dotnet_5_version }} --verbosity=WARN
+
+ files=($(git diff --name-only))
+ if [ ${#files[@]} -gt 0 ]
+ then
+ for file in $files; do echo "::error file=$file::Code format check failed"; done
+ exit 1
+ fi
# Build everything on all platorms (thus testing the developer workflow).
# Upload the native shared libraries as artifacts.
diff --git a/ParquetSharp.DotSettings b/ParquetSharp.DotSettings
new file mode 100644
index 00000000..17996746
--- /dev/null
+++ b/ParquetSharp.DotSettings
@@ -0,0 +1,7 @@
+
+ False
+ True
+ NEVER
+ NEVER
+ NEVER
+
\ No newline at end of file
diff --git a/csharp.benchmark/.editorconfig b/csharp.benchmark/.editorconfig
new file mode 100644
index 00000000..31376257
--- /dev/null
+++ b/csharp.benchmark/.editorconfig
@@ -0,0 +1,29 @@
+[*.{csproj,json,targets}]
+indent_size = 2
+resharper_xml_wrap_tags_and_pi = false
+
+[*.cs]
+csharp_new_line_before_members_in_object_initializers = false
+csharp_preserve_single_line_blocks = true
+resharper_blank_lines_after_block_statements = 0
+resharper_blank_lines_around_auto_property = 0
+resharper_blank_lines_around_single_line_type = 0
+resharper_csharp_blank_lines_around_field = 0
+resharper_csharp_insert_final_newline = true
+resharper_csharp_wrap_lines = false
+resharper_empty_block_style = multiline
+resharper_keep_existing_embedded_block_arrangement = false
+resharper_keep_existing_enum_arrangement = false
+resharper_max_attribute_length_for_same_line = 70
+resharper_place_accessorholder_attribute_on_same_line = false
+resharper_place_expr_accessor_on_single_line = true
+resharper_place_expr_method_on_single_line = true
+resharper_place_expr_property_on_single_line = true
+resharper_place_field_attribute_on_same_line = false
+resharper_place_simple_embedded_statement_on_same_line = true
+resharper_place_simple_initializer_on_single_line = false
+resharper_remove_blank_lines_near_braces_in_code = false
+resharper_remove_blank_lines_near_braces_in_declarations = false
+resharper_wrap_array_initializer_style = chop_if_long
+resharper_wrap_chained_binary_expressions = chop_if_long
+resharper_wrap_object_and_collection_initializer_style = chop_always
\ No newline at end of file
diff --git a/csharp.benchmark/DecimalRead.cs b/csharp.benchmark/DecimalRead.cs
index 2b712a42..3aafc2fc 100644
--- a/csharp.benchmark/DecimalRead.cs
+++ b/csharp.benchmark/DecimalRead.cs
@@ -21,10 +21,10 @@ public DecimalRead()
{
var n = rand.Next();
var sign = rand.NextDouble() < 0.5 ? -1M : +1M;
- return sign * ((decimal)n * n * n) / 1000M;
+ return sign * ((decimal) n * n * n) / 1000M;
}).ToArray();
- using (var fileWriter = new ParquetFileWriter(Filename, new Column[] { new Column("Value", LogicalType.Decimal(precision: 29, scale: 3)) }))
+ using (var fileWriter = new ParquetFileWriter(Filename, new Column[] {new Column("Value", LogicalType.Decimal(precision: 29, scale: 3))}))
{
using var rowGroupWriter = fileWriter.AppendRowGroup();
using var valueWriter = rowGroupWriter.NextColumn().LogicalWriter();
diff --git a/csharp.benchmark/DecimalWrite.cs b/csharp.benchmark/DecimalWrite.cs
index 851e35bb..b6918a20 100644
--- a/csharp.benchmark/DecimalWrite.cs
+++ b/csharp.benchmark/DecimalWrite.cs
@@ -21,7 +21,7 @@ public DecimalWrite()
{
var n = rand.Next();
var sign = rand.NextDouble() < 0.5 ? -1M : +1M;
- return sign * ((decimal)n * n * n) / 1000M;
+ return sign * ((decimal) n * n * n) / 1000M;
}).ToArray();
Console.WriteLine("Generated {0:N0} rows in {1:N2} sec", _values.Length, timer.Elapsed.TotalSeconds);
diff --git a/csharp.benchmark/FloatTimeSeriesBase.cs b/csharp.benchmark/FloatTimeSeriesBase.cs
index 02b56541..edcc4b81 100644
--- a/csharp.benchmark/FloatTimeSeriesBase.cs
+++ b/csharp.benchmark/FloatTimeSeriesBase.cs
@@ -30,7 +30,7 @@ protected static (DateTime[] dates, int[] objectIds, float[][] values, int numRo
.OrderBy(i => i)
.ToArray();
- var values = dates.Select(d => objectIds.Select(o => (float)rand.NextDouble()).ToArray()).ToArray();
+ var values = dates.Select(d => objectIds.Select(o => (float) rand.NextDouble()).ToArray()).ToArray();
var numRows = values.Select(v => v.Length).Aggregate(0, (sum, l) => sum + l);
return (dates, objectIds, values, numRows);
diff --git a/csharp.benchmark/FloatTimeSeriesWrite.cs b/csharp.benchmark/FloatTimeSeriesWrite.cs
index 94f8fe3d..2e78c4ed 100644
--- a/csharp.benchmark/FloatTimeSeriesWrite.cs
+++ b/csharp.benchmark/FloatTimeSeriesWrite.cs
@@ -66,7 +66,7 @@ public long CsvGz()
return new FileInfo("float_timeseries.csv.gz").Length;
}
-
+
[Benchmark(Baseline = true, Description = "Baseline")]
public long Parquet()
{
diff --git a/csharp.benchmark/ParquetSharp.Benchmark.csproj b/csharp.benchmark/ParquetSharp.Benchmark.csproj
index 3edd5033..d25ada6f 100644
--- a/csharp.benchmark/ParquetSharp.Benchmark.csproj
+++ b/csharp.benchmark/ParquetSharp.Benchmark.csproj
@@ -21,4 +21,4 @@
-
+
\ No newline at end of file
diff --git a/csharp.benchmark/Program.cs b/csharp.benchmark/Program.cs
index dbf05b02..4e6e9c52 100644
--- a/csharp.benchmark/Program.cs
+++ b/csharp.benchmark/Program.cs
@@ -17,9 +17,9 @@ public static int Main()
Console.WriteLine("Working directory: {0}", Environment.CurrentDirectory);
var config = DefaultConfig
- .Instance
- .AddColumn(new SizeInBytesColumn())
- .WithOptions(ConfigOptions.Default | ConfigOptions.StopOnFirstError)
+ .Instance
+ .AddColumn(new SizeInBytesColumn())
+ .WithOptions(ConfigOptions.Default | ConfigOptions.StopOnFirstError)
;
var summaries = BenchmarkRunner.Run(new[]
@@ -32,7 +32,7 @@ public static int Main()
// Re-print to the console all the summaries.
var logger = ConsoleLogger.Default;
-
+
logger.WriteLine();
foreach (var summary in summaries)
diff --git a/csharp.benchmark/Properties/launchSettings.json b/csharp.benchmark/Properties/launchSettings.json
index 2e9721c0..2b909e31 100644
--- a/csharp.benchmark/Properties/launchSettings.json
+++ b/csharp.benchmark/Properties/launchSettings.json
@@ -2,7 +2,7 @@
"profiles": {
"ParquetCppSharp.Test": {
"commandName": "Project",
- "nativeDebugging": true
+ "nativeDebugging": true
}
}
}
\ No newline at end of file
diff --git a/csharp.test/.editorconfig b/csharp.test/.editorconfig
new file mode 100644
index 00000000..31376257
--- /dev/null
+++ b/csharp.test/.editorconfig
@@ -0,0 +1,29 @@
+[*.{csproj,json,targets}]
+indent_size = 2
+resharper_xml_wrap_tags_and_pi = false
+
+[*.cs]
+csharp_new_line_before_members_in_object_initializers = false
+csharp_preserve_single_line_blocks = true
+resharper_blank_lines_after_block_statements = 0
+resharper_blank_lines_around_auto_property = 0
+resharper_blank_lines_around_single_line_type = 0
+resharper_csharp_blank_lines_around_field = 0
+resharper_csharp_insert_final_newline = true
+resharper_csharp_wrap_lines = false
+resharper_empty_block_style = multiline
+resharper_keep_existing_embedded_block_arrangement = false
+resharper_keep_existing_enum_arrangement = false
+resharper_max_attribute_length_for_same_line = 70
+resharper_place_accessorholder_attribute_on_same_line = false
+resharper_place_expr_accessor_on_single_line = true
+resharper_place_expr_method_on_single_line = true
+resharper_place_expr_property_on_single_line = true
+resharper_place_field_attribute_on_same_line = false
+resharper_place_simple_embedded_statement_on_same_line = true
+resharper_place_simple_initializer_on_single_line = false
+resharper_remove_blank_lines_near_braces_in_code = false
+resharper_remove_blank_lines_near_braces_in_declarations = false
+resharper_wrap_array_initializer_style = chop_if_long
+resharper_wrap_chained_binary_expressions = chop_if_long
+resharper_wrap_object_and_collection_initializer_style = chop_always
\ No newline at end of file
diff --git a/csharp.test/ParquetSharp.Test.csproj b/csharp.test/ParquetSharp.Test.csproj
index 84e0fa16..7ee9c95f 100644
--- a/csharp.test/ParquetSharp.Test.csproj
+++ b/csharp.test/ParquetSharp.Test.csproj
@@ -25,4 +25,4 @@
-
+
\ No newline at end of file
diff --git a/csharp.test/PhysicalValueGetter.cs b/csharp.test/PhysicalValueGetter.cs
index 0e263b25..a288ef81 100644
--- a/csharp.test/PhysicalValueGetter.cs
+++ b/csharp.test/PhysicalValueGetter.cs
@@ -10,7 +10,7 @@ public PhysicalValueGetter(long numValues)
_numValues = numValues;
}
- public (Array values, short[] definitionLevels, short[] repetitionLevels) OnColumnReader(ColumnReader columnReader)
+ public (Array values, short[] definitionLevels, short[] repetitionLevels) OnColumnReader(ColumnReader columnReader)
where TValue : unmanaged
{
var values = new TValue[_numValues];
@@ -22,11 +22,11 @@ public PhysicalValueGetter(long numValues)
while (columnReader.HasNext)
{
var levelsRead = columnReader.ReadBatch(
- _numValues - totalLevels, defLevels.AsSpan(totalLevels), repLevels.AsSpan(totalLevels), values.AsSpan(totalValues),
+ _numValues - totalLevels, defLevels.AsSpan(totalLevels), repLevels.AsSpan(totalLevels), values.AsSpan(totalValues),
out var valuesRead);
- totalValues += (int)valuesRead;
- totalLevels += (int)levelsRead;
+ totalValues += (int) valuesRead;
+ totalLevels += (int) levelsRead;
}
return (values.Where((v, i) => i < totalValues).ToArray(), defLevels.ToArray(), repLevels.ToArray());
diff --git a/csharp.test/PhysicalValueSetter.cs b/csharp.test/PhysicalValueSetter.cs
index 65c97b98..fdac0d13 100644
--- a/csharp.test/PhysicalValueSetter.cs
+++ b/csharp.test/PhysicalValueSetter.cs
@@ -10,7 +10,7 @@ public ValueSetter(Array values, (int begin, int end)? range = null)
_range = range ?? (0, values.Length);
}
- public Array OnColumnWriter(ColumnWriter columnWriter)
+ public Array OnColumnWriter(ColumnWriter columnWriter)
where TValue : unmanaged
{
var values = (TValue[]) _values;
diff --git a/csharp.test/Program.cs b/csharp.test/Program.cs
index cad74adc..f64b53f4 100644
--- a/csharp.test/Program.cs
+++ b/csharp.test/Program.cs
@@ -1,5 +1,4 @@
-
-using System;
+using System;
using System.Runtime.ExceptionServices;
namespace ParquetSharp.Test
diff --git a/csharp.test/Properties/launchSettings.json b/csharp.test/Properties/launchSettings.json
index 2e9721c0..2b909e31 100644
--- a/csharp.test/Properties/launchSettings.json
+++ b/csharp.test/Properties/launchSettings.json
@@ -2,7 +2,7 @@
"profiles": {
"ParquetCppSharp.Test": {
"commandName": "Project",
- "nativeDebugging": true
+ "nativeDebugging": true
}
}
}
\ No newline at end of file
diff --git a/csharp.test/TestAadPrefixVerifier.cs b/csharp.test/TestAadPrefixVerifier.cs
index 01e94970..371ab4d3 100644
--- a/csharp.test/TestAadPrefixVerifier.cs
+++ b/csharp.test/TestAadPrefixVerifier.cs
@@ -54,4 +54,4 @@ public TestVerifier(string exceptionMessage)
public override void Verify(string aadPrefix) => throw new ArgumentException(ExceptionMessage);
}
}
-}
\ No newline at end of file
+}
diff --git a/csharp.test/TestBuffer.cs b/csharp.test/TestBuffer.cs
index acae474f..8a0aec5f 100644
--- a/csharp.test/TestBuffer.cs
+++ b/csharp.test/TestBuffer.cs
@@ -62,7 +62,7 @@ public static void TestBufferOutputStreamFinish()
{
var expected = Enumerable.Range(0, 100).ToArray();
using var outStream = new BufferOutputStream();
-
+
// Write out a single column
using (var fileWriter = new ParquetFileWriter(outStream, new Column[] {new Column("int_field")}))
{
diff --git a/csharp.test/TestByteArrayReaderCache.cs b/csharp.test/TestByteArrayReaderCache.cs
index 45ae3f30..4cd52b93 100644
--- a/csharp.test/TestByteArrayReaderCache.cs
+++ b/csharp.test/TestByteArrayReaderCache.cs
@@ -54,7 +54,7 @@ public static void TestReadingDuplicateStrings([Values(true, false)] bool enable
// When reading back the file, we expect the duplicate strings to point to the same memory instances.
Assert.That(
- readValues.Distinct(new StringReferenceComparer()).Count(),
+ readValues.Distinct(new StringReferenceComparer()).Count(),
enableDictionary ? Is.EqualTo(100) : Is.EqualTo(numRows));
}
diff --git a/csharp.test/TestColumn.cs b/csharp.test/TestColumn.cs
index ef67e22d..206a9816 100644
--- a/csharp.test/TestColumn.cs
+++ b/csharp.test/TestColumn.cs
@@ -47,7 +47,7 @@ public static void TestUnsupportedType()
[Test]
public static void TestUnsupportedLogicalTypeOverride()
{
- var exception = Assert.Throws(() =>
+ var exception = Assert.Throws(() =>
new Column("DateTime", LogicalType.Json()).CreateSchemaNode());
Assert.That(
diff --git a/csharp.test/TestColumnPath.cs b/csharp.test/TestColumnPath.cs
index d86d03cc..f0fbbb43 100644
--- a/csharp.test/TestColumnPath.cs
+++ b/csharp.test/TestColumnPath.cs
@@ -19,7 +19,7 @@ public static void TestDotRepresentations()
Assert.AreEqual(new[] {"root", "part0", "part1"}, p1.ToDotVector());
using var p2 = p0.Extend("part2");
-
+
Assert.AreEqual("root.part0.part1.part2", p2.ToDotString());
}
@@ -85,7 +85,7 @@ public static void TestNodeRepresentationUtf8()
Assert.AreEqual("", schema.Path.ToDotString());
Assert.AreEqual(name + "", schema.Field(0).Path.ToDotString());
- Assert.AreEqual(name+ ".list", ((GroupNode) schema.Field(0)).Field(0).Path.ToDotString());
+ Assert.AreEqual(name + ".list", ((GroupNode) schema.Field(0)).Field(0).Path.ToDotString());
Assert.AreEqual(name + ".list.item", ((GroupNode) ((GroupNode) schema.Field(0)).Field(0)).Field(0).Path.ToDotString());
}
}
diff --git a/csharp.test/TestColumnReader.cs b/csharp.test/TestColumnReader.cs
index b832b6ea..69a15e08 100644
--- a/csharp.test/TestColumnReader.cs
+++ b/csharp.test/TestColumnReader.cs
@@ -47,9 +47,9 @@ public static void TestSkip()
{
const int numRows = 11;
- var schemaColumns = new Column[] { new Column("int32_field") };
+ var schemaColumns = new Column[] {new Column("int32_field")};
var values = Enumerable.Range(0, numRows).ToArray();
-
+
using var buffer = new ResizableBuffer();
using (var outStream = new BufferOutputStream(buffer))
diff --git a/csharp.test/TestColumnWriter.cs b/csharp.test/TestColumnWriter.cs
index 3f39fe57..ba71459d 100644
--- a/csharp.test/TestColumnWriter.cs
+++ b/csharp.test/TestColumnWriter.cs
@@ -17,7 +17,7 @@ public static void TestWriteBatchWithNullOptionalField()
using var writer = new ParquetFileWriter(outStream, new Column[] {new Column("int32?")});
using var rowGroupWriter = writer.AppendRowGroup();
using var colWriter = (ColumnWriter) rowGroupWriter.NextColumn();
-
+
var defLevels = new short[] {1, 0, 1};
var values = new[] {1, 2};
@@ -43,7 +43,7 @@ public static void TestUnsupportedType()
using var buffer = new ResizableBuffer();
using var outStream = new BufferOutputStream(buffer);
- var exception = Assert.Throws(() =>
+ var exception = Assert.Throws(() =>
new ParquetFileWriter(outStream, new Column[] {new Column