This is an automated email from the ASF dual-hosted git repository. jackietien pushed a commit to branch ai-code/flight-sql in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 9e8d51a8efbb7382e6b0381632d3454b26ae68fc Author: JackieTien97 <[email protected]> AuthorDate: Mon Feb 23 17:15:32 2026 +0800 add some code style pronmps --- .gemini/STYLE.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+) diff --git a/.gemini/STYLE.md b/.gemini/STYLE.md new file mode 100644 index 00000000000..bddc85b2dc6 --- /dev/null +++ b/.gemini/STYLE.md @@ -0,0 +1,80 @@ +# IoTDB Java Code Style Guide + +This document defines the coding rules that **must** be followed when generating or modifying Java code in this project. These rules are enforced by CheckStyle (`checkstyle.xml`) and Spotless (`pom.xml`). + +## Imports + +1. **Star imports are forbidden**: Never use `import xxx.*` or `import static xxx.*`. Always list each required class or static member explicitly. +2. **Import ordering** (enforced by Spotless): + ``` + org.apache.iotdb.* + ← blank line + Other third-party packages (e.g. org.apache.arrow, com.google, etc.) + ← blank line + javax.* + java.* + ← blank line + static imports + ``` +3. **Remove unused imports**. + +## Formatting + +- Use **Google Java Format** (GOOGLE style). +- Indent with **2 spaces**, no tabs. +- Line width limit is **100 characters** (except `package`, `import`, and URL lines). +- Use **UNIX (LF)** line endings. + +## Naming Conventions + +| Type | Rule | Example | +|------|------|---------| +| Package | All lowercase, dot-separated | `org.apache.iotdb.flight` | +| Class | UpperCamelCase | `TsBlockToArrowConverter` | +| Method | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9_]*$`) | `fillVectorSchemaRoot` | +| Member variable | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9]*$`) | `allocator` | +| Parameter | lowerCamelCase | `tsBlock` | +| Constant | UPPER_SNAKE_CASE, at most 1 consecutive uppercase letter in abbreviations | `MAX_RETRY_COUNT` | + +## Code Structure + +- Only one top-level class per `.java` file. +- `switch` statements must have a `default` branch. +- Empty `try`/`catch`/`if`/`else`/`switch` blocks are not allowed (unless they contain a comment). +- Exception variables in empty `catch` blocks must be named `expected`. +- `if`/`else`/`for`/`while`/`do` must use braces `{}`. + +## License Header + +Every Java file must start with the Apache License 2.0 header: + +```java +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +``` + +## Verification Commands + +```bash +# Format code +mvn spotless::apply -P with-integration-tests + +# Check style +mvn checkstyle::check -P with-integration-tests +``` diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000000..8a8d8ef3bbc --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,80 @@ +# IoTDB Java Code Style Guide + +This document defines the coding rules that **must** be followed when generating or modifying Java code in this project. These rules are enforced by CheckStyle (`checkstyle.xml`) and Spotless (`pom.xml`). + +## Imports + +1. **Star imports are forbidden**: Never use `import xxx.*` or `import static xxx.*`. Always list each required class or static member explicitly. +2. **Import ordering** (enforced by Spotless): + ``` + org.apache.iotdb.* + ← blank line + Other third-party packages (e.g. org.apache.arrow, com.google, etc.) + ← blank line + javax.* + java.* + ← blank line + static imports + ``` +3. **Remove unused imports**. + +## Formatting + +- Use **Google Java Format** (GOOGLE style). +- Indent with **2 spaces**, no tabs. +- Line width limit is **100 characters** (except `package`, `import`, and URL lines). +- Use **UNIX (LF)** line endings. + +## Naming Conventions + +| Type | Rule | Example | +|------|------|---------| +| Package | All lowercase, dot-separated | `org.apache.iotdb.flight` | +| Class | UpperCamelCase | `TsBlockToArrowConverter` | +| Method | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9_]*$`) | `fillVectorSchemaRoot` | +| Member variable | lowerCamelCase (`^[a-z][a-z0-9][a-zA-Z0-9]*$`) | `allocator` | +| Parameter | lowerCamelCase | `tsBlock` | +| Constant | UPPER_SNAKE_CASE, at most 1 consecutive uppercase letter in abbreviations | `MAX_RETRY_COUNT` | + +## Code Structure + +- Only one top-level class per `.java` file. +- `switch` statements must have a `default` branch. +- Empty `try`/`catch`/`if`/`else`/`switch` blocks are not allowed (unless they contain a comment). +- Exception variables in empty `catch` blocks must be named `expected`. +- `if`/`else`/`for`/`while`/`do` must use braces `{}`. + +## License Header + +Every Java file must start with the Apache License 2.0 header: + +```java +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +``` + +## Verification Commands + +```bash +# Format code +mvn spotless::apply -P with-integration-tests + +# Check style +mvn checkstyle::check -P with-integration-tests +```
