From 93cb1819468218facbbf4abd427bafc3eea9abb3 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Fri, 19 Dec 2025 15:46:26 -0800 Subject: [PATCH 1/2] Start giving Junie some code-generation guidelines --- .junie/guidelines/java.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .junie/guidelines/java.md diff --git a/.junie/guidelines/java.md b/.junie/guidelines/java.md new file mode 100644 index 0000000000..cab955da24 --- /dev/null +++ b/.junie/guidelines/java.md @@ -0,0 +1,17 @@ +### Java Coding Guidelines + +#### General +- Prefer `Stream` API over traditional for-loops for collection processing. +- Whenever possible, use try-with-resources for automatic resource management. +- Always ask before adding, removing, or updating a third-party library dependency. +- Always use org.jetbrains.annotations.NotNull and org.jetbrains.annotations.Nullable for nullability annotations. +- Be explicit about nullability in public API method signatures. + +#### Logging +- Use Log4J2 for logging. +- Name the static logger `LOG` and initialize it using `org.labkey.api.util.logging.LogHelper.getLogger()`. + +#### Testing +- For unit tests, create a static `TestCase` inner class extending `Assert` in the same file as production code. +- Add new `TestCase` classes to the owning module's list in `getUnitTests()` +- Use JUnit 4 annotations (e.g., @Test) for these inner test classes. \ No newline at end of file From d0d9bb760e97219b361d916122b61ae8728fc5a4 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Fri, 19 Dec 2025 17:17:04 -0800 Subject: [PATCH 2/2] Remind Junie to use the existing formatting rules --- .junie/guidelines/formatting.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .junie/guidelines/formatting.md diff --git a/.junie/guidelines/formatting.md b/.junie/guidelines/formatting.md new file mode 100644 index 0000000000..8e51d17256 --- /dev/null +++ b/.junie/guidelines/formatting.md @@ -0,0 +1,4 @@ +### Code Formatting Guidelines + +- All code formatting must strictly adhere to the IntelliJ IDEA project settings defined in `.idea/codeStyles/Project.xml`. +- Read and follow the specific rules configured in that file for all supported languages (Java, JavaScript, TypeScript, CSS, Python, etc.).