This is an automated email from the ASF dual-hosted git repository.
CurtHagenlocher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new ffa5f0a2f chore(csharp): enable formatting check via `dotnet format`
(#4351)
ffa5f0a2f is described below
commit ffa5f0a2f32d83dcecf159ad9a25da0492c4f759
Author: Curt Hagenlocher <[email protected]>
AuthorDate: Mon Jun 1 12:43:45 2026 -0700
chore(csharp): enable formatting check via `dotnet format` (#4351)
---
.pre-commit-config.yaml | 7 +++++++
csharp/src/Apache.Arrow.Adbc/Extensions/IArrowArrayExtensions.cs | 2 +-
csharp/src/Apache.Arrow.Adbc/Tracing/ActivityTrace.cs | 2 +-
csharp/test/Apache.Arrow.Adbc.Tests/AdbcTests.cs | 2 +-
csharp/test/Apache.Arrow.Adbc.Tests/ClientTests.cs | 4 ++--
csharp/test/Apache.Arrow.Adbc.Tests/Metadata/AdbcTable.cs | 2 +-
csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs | 3 ++-
csharp/test/Apache.Arrow.Adbc.Tests/Xunit/OrderAttribute.cs | 2 +-
csharp/test/Drivers/Interop/FlightSql/FlightSqlData.cs | 2 +-
csharp/test/Drivers/Interop/FlightSql/FlightSqlTestingUtils.cs | 6 +++---
.../Telemetry/Traces/Exporters/FileExporter/FileExporterTests.cs | 2 +-
11 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 852755633..05c1bd261 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -131,6 +131,13 @@ repos:
pass_filenames: true
files:
'(^\.pre-commit-config\.yaml$)|(^\.github/workflows/.*\.(yml|yaml)$)'
entry: "./ci/scripts/run_pre_commit_pin.py"
+ - id: dotnet-format
+ name: C# Format
+ language: system
+ entry: |
+ dotnet format csharp/Apache.Arrow.Adbc.sln --verify-no-changes
+ always_run: true
+ pass_filenames: false
- repo: https://github.com/doublify/pre-commit-rust
rev: eeee35a89e69d5772bdee97db1a6a898467b686e # v1.0
hooks:
diff --git a/csharp/src/Apache.Arrow.Adbc/Extensions/IArrowArrayExtensions.cs
b/csharp/src/Apache.Arrow.Adbc/Extensions/IArrowArrayExtensions.cs
index 2eaf75a9c..acdf80e75 100644
--- a/csharp/src/Apache.Arrow.Adbc/Extensions/IArrowArrayExtensions.cs
+++ b/csharp/src/Apache.Arrow.Adbc/Extensions/IArrowArrayExtensions.cs
@@ -238,7 +238,7 @@ namespace Apache.Arrow.Adbc.Extensions
((Decimal256Array)array).GetString(index) :
((StringArray)array).GetString(index);
case ArrowTypeId.LargeString:
- return (array, index)
=>((LargeStringArray)array).GetString(index);
+ return (array, index) =>
((LargeStringArray)array).GetString(index);
#if NET6_0_OR_GREATER
case ArrowTypeId.Time32:
return (array, index) =>
((Time32Array)array).GetTime(index);
diff --git a/csharp/src/Apache.Arrow.Adbc/Tracing/ActivityTrace.cs
b/csharp/src/Apache.Arrow.Adbc/Tracing/ActivityTrace.cs
index 273fa930c..a261cd2c6 100644
--- a/csharp/src/Apache.Arrow.Adbc/Tracing/ActivityTrace.cs
+++ b/csharp/src/Apache.Arrow.Adbc/Tracing/ActivityTrace.cs
@@ -267,7 +267,7 @@ namespace Apache.Arrow.Adbc.Tracing
/// <summary>
/// If possible, gets the file version for the assembly associated
with the given Type.
/// </summary>
- [SuppressMessage("SingleFile", "IL3000", Justification="Using guard")]
+ [SuppressMessage("SingleFile", "IL3000", Justification = "Using
guard")]
public static string GetAssemblyVersion(Type type)
{
var versionAttr =
type.Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
diff --git a/csharp/test/Apache.Arrow.Adbc.Tests/AdbcTests.cs
b/csharp/test/Apache.Arrow.Adbc.Tests/AdbcTests.cs
index 3b55387b1..347f127ef 100644
--- a/csharp/test/Apache.Arrow.Adbc.Tests/AdbcTests.cs
+++ b/csharp/test/Apache.Arrow.Adbc.Tests/AdbcTests.cs
@@ -207,7 +207,7 @@ namespace Apache.Arrow.Adbc.Tests
{
// find the adbc.h file from the repo
- string path = Path.Combine(new string[] { "..", "..", "..", "..",
"..", "c", "include", "arrow-adbc", "adbc.h"});
+ string path = Path.Combine(new string[] { "..", "..", "..", "..",
"..", "c", "include", "arrow-adbc", "adbc.h" });
Assert.True(File.Exists(path));
diff --git a/csharp/test/Apache.Arrow.Adbc.Tests/ClientTests.cs
b/csharp/test/Apache.Arrow.Adbc.Tests/ClientTests.cs
index ac2d4159f..0eeedb1d1 100644
--- a/csharp/test/Apache.Arrow.Adbc.Tests/ClientTests.cs
+++ b/csharp/test/Apache.Arrow.Adbc.Tests/ClientTests.cs
@@ -65,7 +65,7 @@ namespace Apache.Arrow.Adbc.Tests
int rows = adbcCommand.ExecuteNonQuery();
- Assert.True(expectedResults[i]==rows,
Utils.FormatMessage("Expected results are not equal", environmentName));
+ Assert.True(expectedResults[i] == rows,
Utils.FormatMessage("Expected results are not equal", environmentName));
}
}
@@ -187,7 +187,7 @@ namespace Apache.Arrow.Adbc.Tests
{
var column_schema = reader.GetColumnSchema();
DataTable? dataTable = reader.GetSchemaTable();
- Assert.True(dataTable != null,
Utils.FormatMessage("dataTable is null", environmentName) );
+ Assert.True(dataTable != null,
Utils.FormatMessage("dataTable is null", environmentName));
Assert.True(reader.FieldCount ==
sample.ExpectedValues.Count,
Utils.FormatMessage($"{sample.ExpectedValues.Count} fields were expected but
{reader.FieldCount} fields were returned for the query [{sample.Query}]",
environmentName));
diff --git a/csharp/test/Apache.Arrow.Adbc.Tests/Metadata/AdbcTable.cs
b/csharp/test/Apache.Arrow.Adbc.Tests/Metadata/AdbcTable.cs
index 7f119f295..6f3b133a3 100644
--- a/csharp/test/Apache.Arrow.Adbc.Tests/Metadata/AdbcTable.cs
+++ b/csharp/test/Apache.Arrow.Adbc.Tests/Metadata/AdbcTable.cs
@@ -42,6 +42,6 @@ namespace Apache.Arrow.Adbc.Tests.Metadata
/// <summary>
/// The constrains associated with the table.
/// </summary>
- public List<AdbcConstraint>? Constraints { get; set; }
+ public List<AdbcConstraint>? Constraints { get; set; }
}
}
diff --git a/csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs
b/csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs
index 111540467..15a8d342e 100644
--- a/csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs
+++ b/csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs
@@ -616,7 +616,8 @@ namespace Apache.Arrow.Adbc.Tests
protected static void AssertContainsAll(string[] expectedTexts, string
value)
{
- if (expectedTexts == null) { return; };
+ if (expectedTexts == null) { return; }
+
foreach (string text in expectedTexts)
{
Assert.Contains(text, value);
diff --git a/csharp/test/Apache.Arrow.Adbc.Tests/Xunit/OrderAttribute.cs
b/csharp/test/Apache.Arrow.Adbc.Tests/Xunit/OrderAttribute.cs
index 7831fdf96..07c404209 100644
--- a/csharp/test/Apache.Arrow.Adbc.Tests/Xunit/OrderAttribute.cs
+++ b/csharp/test/Apache.Arrow.Adbc.Tests/Xunit/OrderAttribute.cs
@@ -23,7 +23,7 @@ namespace Apache.Arrow.Adbc.Tests.Xunit
/// Used to specify the order of Xunit tests.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
- public class OrderAttribute : Attribute
+ public class OrderAttribute : Attribute
{
public int Order { get; private set; }
diff --git a/csharp/test/Drivers/Interop/FlightSql/FlightSqlData.cs
b/csharp/test/Drivers/Interop/FlightSql/FlightSqlData.cs
index 42c5a2323..5cc2c3f24 100644
--- a/csharp/test/Drivers/Interop/FlightSql/FlightSqlData.cs
+++ b/csharp/test/Drivers/Interop/FlightSql/FlightSqlData.cs
@@ -262,7 +262,7 @@ namespace Apache.Arrow.Adbc.Tests.Drivers.Interop.FlightSql
StructBehavior = "Strict",
Query = "SELECT " +
"ARRAY[n_regionkey, n_nationkey] AS \"List\", " +
- "struct(n_regionkey, 'Test Value') AS Struct "+
+ "struct(n_regionkey, 'Test Value') AS Struct " +
"FROM nation WHERE n_regionkey = 0 AND n_nationkey
= 5",
ExpectedValues = new List<ColumnNetTypeArrowTypeValue>()
{
diff --git a/csharp/test/Drivers/Interop/FlightSql/FlightSqlTestingUtils.cs
b/csharp/test/Drivers/Interop/FlightSql/FlightSqlTestingUtils.cs
index 22fde0ce0..74d0b776b 100644
--- a/csharp/test/Drivers/Interop/FlightSql/FlightSqlTestingUtils.cs
+++ b/csharp/test/Drivers/Interop/FlightSql/FlightSqlTestingUtils.cs
@@ -45,14 +45,14 @@ namespace Apache.Arrow.Adbc.Tests.Drivers.Interop.FlightSql
{
// see https://arrow.apache.org/adbc/main/driver/flight_sql.html
- parameters = new Dictionary<string, string>{};
+ parameters = new Dictionary<string, string> { };
- if(!string.IsNullOrEmpty(environment.Uri))
+ if (!string.IsNullOrEmpty(environment.Uri))
{
parameters.Add(FlightSqlParameters.Uri, environment.Uri!);
}
- foreach(string key in environment.RPCCallHeaders.Keys)
+ foreach (string key in environment.RPCCallHeaders.Keys)
{
parameters.Add(FlightSqlParameters.OptionRPCCallHeaderPrefix +
key, environment.RPCCallHeaders[key]);
}
diff --git
a/csharp/test/Telemetry/Traces/Exporters/FileExporter/FileExporterTests.cs
b/csharp/test/Telemetry/Traces/Exporters/FileExporter/FileExporterTests.cs
index 4e62ea67b..66e6b4fa3 100644
--- a/csharp/test/Telemetry/Traces/Exporters/FileExporter/FileExporterTests.cs
+++ b/csharp/test/Telemetry/Traces/Exporters/FileExporter/FileExporterTests.cs
@@ -21,11 +21,11 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Apache.Arrow.Adbc.Telemetry.Traces.Exporters.FileExporter;
using OpenTelemetry;
using OpenTelemetry.Trace;
using Xunit;
using Xunit.Abstractions;
-using Apache.Arrow.Adbc.Telemetry.Traces.Exporters.FileExporter;
namespace Apache.Arrow.Adbc.Tests.Telemetry.Traces.Exporters.FileExporter
{