Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 5 additions & 25 deletions .github/workflows/pre-commit-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
18 changes: 18 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)中找到如何发布
Loading
Loading