When developing or modifying code within the java-bigtable directory, you must strictly follow these rules and perform these actions:
- Always pull the latest changes from the
mainbranch ofgit@github.com:googleapis/google-cloud-java.gitbefore starting work. - Checkout a new branch for your development instead of committing directly to
main.
- Always write unit tests for any new logic or modifications you implement.
- Follow JUnit 5 conventions for writing and structuring tests (e.g., using
@Test,@BeforeEach, etc., fromorg.junit.jupiter.api). - Do not use JUnit 4 unless modifying an existing file that hasn't been migrated yet, but for new tests default to JUnit 5.
- After writing or updating code, always check that imports are properly cleaned up.
- Avoid using fully qualified class names (e.g.,
x.y.z.Class) directly inline in the code. - Ensure all required classes are imported in the header of the Java file.
- Remove any unused imports.
- Automatically format the code using the
fmt-maven-plugin. - Before finalizing your changes, run the following command in the terminal from the
java-bigtabledirectory or the relevant module directory:mvn com.spotify.fmt:fmt-maven-plugin:format
- 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).