Skip to content

Commit 69689c3

Browse files
authored
chore: add rules for basic development guidance (#13516)
1 parent 577f6e8 commit 69689c3

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

java-bigtable/AGENTS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Java Bigtable Development Guidelines
2+
3+
When developing or modifying code within the `java-bigtable` directory, you must strictly follow these rules and perform these actions:
4+
5+
## 1. Source Control
6+
- **Always** pull the latest changes from the `main` branch of `git@github.com:googleapis/google-cloud-java.git` before starting work.
7+
- Checkout a new branch for your development instead of committing directly to `main`.
8+
9+
## 2. Unit Testing
10+
- **Always write unit tests** for any new logic or modifications you implement.
11+
- Follow **JUnit 5** conventions for writing and structuring tests (e.g., using `@Test`, `@BeforeEach`, etc., from `org.junit.jupiter.api`).
12+
- Do not use JUnit 4 unless modifying an existing file that hasn't been migrated yet, but for new tests default to JUnit 5.
13+
14+
## 3. Clean Up Imports
15+
- After writing or updating code, **always** check that imports are properly cleaned up.
16+
- Avoid using fully qualified class names (e.g., `x.y.z.Class`) directly inline in the code.
17+
- Ensure all required classes are imported in the header of the Java file.
18+
- Remove any unused imports.
19+
20+
## 4. Code Formatting
21+
- Automatically format the code using the `fmt-maven-plugin`.
22+
- Before finalizing your changes, run the following command in the terminal from the `java-bigtable` directory or the relevant module directory:
23+
```bash
24+
mvn com.spotify.fmt:fmt-maven-plugin:format
25+
```
26+
- **Troubleshooting**: If the formatting command fails, it is usually because of an incompatible JDK version. Ensure you are running it in an environment with the correct JDK version for the project (typically 17+, depending on the project configuration).

0 commit comments

Comments
 (0)