You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by cr...@apache.org on 2026/02/06 07:03:28 UTC
(iotdb-client-csharp) 01/01: switch to dotnet format
This is an automated email from the ASF dual-hosted git repository.
critas pushed a commit to branch feature/dotnet-format-ci
in repository https://gitbox.apache.org/repos/asf/iotdb-client-csharp.git
commit ffe92ea8b45ba5d23b81e2aa9141deea8f64ba1e
Author: CritasWang <cr...@outlook.com>
AuthorDate: Fri Feb 6 15:03:11 2026 +0800
switch to dotnet format
---
.editorconfig | 4 ++++
.github/workflows/pre-commit-format.yml | 30 +++++-------------------------
README.md | 18 ++++++++++++++++++
README_ZH.md | 18 ++++++++++++++++++
4 files changed, 45 insertions(+), 25 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index 7f6de4d..3c8687f 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -37,6 +37,10 @@ indent_size = 2
[*{_AssemblyInfo.cs,.notsupported.cs,*/obj/*/External/**/*,*/obj/dotnet-new.IntegrationTests/*/TemplatePackagesPaths.cs}]
generated_code = true
+# Thrift generated code
+[src/Apache.IoTDB/Rpc/Generated/**]
+generated_code = true
+
# C# files
[*.cs]
# New line preferences
diff --git a/.github/workflows/pre-commit-format.yml b/.github/workflows/pre-commit-format.yml
index 3b7589c..7ef53be 100644
--- a/.github/workflows/pre-commit-format.yml
+++ b/.github/workflows/pre-commit-format.yml
@@ -7,15 +7,13 @@ on:
- "**"
merge_group:
branches: [main]
- # schedule:
- # - cron: "0 0 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
- formatting-checks:
+ dotnet-format:
runs-on: ubuntu-22.04
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
@@ -29,27 +27,9 @@ jobs:
with:
dotnet-version: "9.0.x"
- - name: Setup Python environment (for pre-commit)
- uses: actions/setup-python@v5
- with:
- python-version: "3.10"
-
- - name: Clean dotnet temporary folder
- run: |
- sudo rm -rf /tmp/.dotnet
- mkdir -p ${{ runner.temp }}/dotnet-home
- mkdir -p ${{ runner.temp }}/xdg-runtime
-
- - name: Install pre-commit and dependencies
- run: |
- pip install pre-commit
- pre-commit install-hooks
+ - name: Restore dependencies
+ run: dotnet restore
- - name: Run pre-commit checks
- env:
- TMPDIR: ${{ runner.temp }}
- DOTNET_CLI_HOME: ${{ runner.temp }}/dotnet-home
- XDG_RUNTIME_DIR: ${{ runner.temp }}/xdg-runtime
- NUGET_PACKAGES: ${{ runner. temp }}/nuget-packages
+ - name: Check formatting
run: |
- pre-commit run --all-files
+ dotnet format --verify-no-changes --verbosity diagnostic
diff --git a/README.md b/README.md
index 7f46166..f395763 100644
--- a/README.md
+++ b/README.md
@@ -82,5 +82,23 @@ NLog >= 4.7.9
* dotnet CLI
* Thrift
+## Code Formatting
+
+This project uses `dotnet format` to enforce consistent code style based on the [.editorconfig](.editorconfig) rules.
+
+### Check formatting locally
+
+```bash
+dotnet format --verify-no-changes
+```
+
+### Auto-fix formatting issues
+
+```bash
+dotnet format
+```
+
+The CI pipeline will automatically check code formatting on all pull requests. Please ensure your code is properly formatted before submitting a PR.
+
## Publish your own client on nuget.org
You can find out how to publish from this [doc](./PUBLISH.md).
\ No newline at end of file
diff --git a/README_ZH.md b/README_ZH.md
index 440477c..df2f500 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -81,5 +81,23 @@ NLog >= 4.7.9
* dotnet CLI
* Thrift
+## 代码格式化
+
+本项目使用 `dotnet format` 基于 [.editorconfig](.editorconfig) 规则来强制执行一致的代码风格。
+
+### 本地检查格式
+
+```bash
+dotnet format --verify-no-changes
+```
+
+### 自动修复格式问题
+
+```bash
+dotnet format
+```
+
+CI 流水线会在所有 Pull Request 上自动检查代码格式。请确保在提交 PR 之前代码格式正确。
+
## 在 nuget.org 上发布你自己的客户端
你可以在这个[文档](./PUBLISH.md)中找到如何发布
\ No newline at end of file