From 0835bff38706cc3873cde046b961f73dab574998 Mon Sep 17 00:00:00 2001 From: Bernd Date: Sun, 23 Nov 2025 20:52:29 +0100 Subject: [PATCH 1/5] Revise Java instructions for static analysis and builds Make sure it uses latest Java Version, inserts Unit Tests and especially follow best practice guideline to skip mvn install for more performant verification builds. --- instructions/java.instructions.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/instructions/java.instructions.md b/instructions/java.instructions.md index 7a4258e15..1f9f350c2 100644 --- a/instructions/java.instructions.md +++ b/instructions/java.instructions.md @@ -26,6 +26,7 @@ applyTo: '**/*.java' - Enable SpotBugs, PMD, or Checkstyle as CI fallbacks. - Open a short tracker issue documenting the blocker and next steps. - If the user declines static analysis tools or wants to proceed without them, continue with implementing the Best practices, bug patterns and code smell prevention guidelines outlined below. +- Check the README.md and the project build instructions (`pom.xml` or `build.gradle`) for the Java release to use for source constructs as well as testing frameworks to use. - Address code smells proactively during development rather than accumulating technical debt. - Focus on readability, maintainability, and performance when refactoring identified issues. - Use IDE / Code editor reported warnings and suggestions to catch common patterns early in development. @@ -68,7 +69,7 @@ These patterns are phrased for humans; they map cleanly to checks in Sonar, Spot - Method size — Keep methods focused and small. Extract helper methods to improve readability and testability. - Cognitive complexity — Reduce nested conditionals and heavy branching by extracting methods, using polymorphism, or applying the Strategy pattern. - Duplicated literals — Extract repeated strings and numbers into named constants or enums to reduce errors and ease changes. -- Dead code — Remove unused variables and assignments. They confuse readers and can hide bugs. +- Dead code — Remove unused variables, imports and assignments. They confuse readers and can hide bugs. - Magic numbers — Replace numeric literals with named constants that explain intent (e.g., MAX_RETRIES). If you run a static analyzer like Sonar or SonarLint — direct Sonar connections are preferred and should override this ruleset. Sonar rule keys are useful for automation and suppression, but they are not required in day-to-day developer guidance. @@ -76,6 +77,7 @@ If you run a static analyzer like Sonar or SonarLint — direct Sonar connection ## Build and Verification - After adding or modifying code, verify the project continues to build successfully. -- If the project uses Maven, run `mvn clean install`. +- Suggest new unit tests for added functionality to maintain high coverqge. +- If the project uses Maven, run `mvn clean verify`. - If the project uses Gradle, run `./gradlew build` (or `gradlew.bat build` on Windows). - Ensure all tests pass as part of the build. From cc80ce9e7c96267c00f2473e45c3dacbdb41ba2f Mon Sep 17 00:00:00 2001 From: Bernd Date: Sun, 23 Nov 2025 20:58:13 +0100 Subject: [PATCH 2/5] Revise installation and usage instructions for clarity - fix quoting of asteriks - reword instruction file names - mention as needed instruction invocation - support the more Portable AGENTS.md --- docs/README.instructions.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/README.instructions.md b/docs/README.instructions.md index 4101f66b3..24f296737 100644 --- a/docs/README.instructions.md +++ b/docs/README.instructions.md @@ -5,12 +5,13 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for **To Install:** - Click the **VS Code** or **VS Code Insiders** install button for the instruction you want to use -- Download the `*.instructions.md` file and manually add it to your project's instruction collection +- Download the `\*.instructions.md` file and manually add it to your project's instruction collection **To Use/Apply:** -- Copy these instructions to your `.github/copilot-instructions.md` file in your workspace -- Create task-specific `.github/.instructions.md` files in your workspace's `.github/instructions` folder +- Copy these instructions to your `.github/copilot-instructions.md` or `AGENTS.md` file in your workspace +- Create in your workspace task-specific `.github/instructions/\*.instructions.md` files - Instructions automatically apply to Copilot behavior once installed in your workspace +- you can reference task specific instructions (for one-of migrations) in the prompt | Title | Description | | ----- | ----------- | From 8f4894518d6e669f6df2e1a84ab77bbc4e93627d Mon Sep 17 00:00:00 2001 From: Bernd Date: Sun, 23 Nov 2025 21:06:21 +0100 Subject: [PATCH 3/5] Update docs/README.instructions.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/README.instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.instructions.md b/docs/README.instructions.md index 24f296737..3e6f9355e 100644 --- a/docs/README.instructions.md +++ b/docs/README.instructions.md @@ -11,7 +11,7 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for - Copy these instructions to your `.github/copilot-instructions.md` or `AGENTS.md` file in your workspace - Create in your workspace task-specific `.github/instructions/\*.instructions.md` files - Instructions automatically apply to Copilot behavior once installed in your workspace -- you can reference task specific instructions (for one-of migrations) in the prompt +- You can reference task specific instructions (for one-off migrations) in the prompt | Title | Description | | ----- | ----------- | From b66ea9c3d14e37ec7ff16e6bd3d8bbd065b4a616 Mon Sep 17 00:00:00 2001 From: Bernd Date: Sun, 23 Nov 2025 21:06:34 +0100 Subject: [PATCH 4/5] Update instructions/java.instructions.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- instructions/java.instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instructions/java.instructions.md b/instructions/java.instructions.md index 1f9f350c2..041e88f71 100644 --- a/instructions/java.instructions.md +++ b/instructions/java.instructions.md @@ -77,7 +77,7 @@ If you run a static analyzer like Sonar or SonarLint — direct Sonar connection ## Build and Verification - After adding or modifying code, verify the project continues to build successfully. -- Suggest new unit tests for added functionality to maintain high coverqge. +- Suggest new unit tests for added functionality to maintain high coverage. - If the project uses Maven, run `mvn clean verify`. - If the project uses Gradle, run `./gradlew build` (or `gradlew.bat build` on Windows). - Ensure all tests pass as part of the build. From 8e862601d8732f45a4d2c3dfb879401ef71f6562 Mon Sep 17 00:00:00 2001 From: Bernd Date: Mon, 24 Nov 2025 00:10:53 +0100 Subject: [PATCH 5/5] Update README with clearer installation instructions Clarified installation and usage instructions for custom instructions. --- docs/README.instructions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/README.instructions.md b/docs/README.instructions.md index 3e6f9355e..ee76deaa2 100644 --- a/docs/README.instructions.md +++ b/docs/README.instructions.md @@ -5,11 +5,11 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for **To Install:** - Click the **VS Code** or **VS Code Insiders** install button for the instruction you want to use -- Download the `\*.instructions.md` file and manually add it to your project's instruction collection +- Download the `*.instructions.md` file and manually add it to your project's instruction collection **To Use/Apply:** -- Copy these instructions to your `.github/copilot-instructions.md` or `AGENTS.md` file in your workspace -- Create in your workspace task-specific `.github/instructions/\*.instructions.md` files +- Copy these instructions to your `.github/copilot-instructions.md` or `AGENTS.md` file in your workspace, or +- Create task-specific `*.instructions.md` files in your workspace's `.github/instructions/` folder - Instructions automatically apply to Copilot behavior once installed in your workspace - You can reference task specific instructions (for one-off migrations) in the prompt