From 67e51486e75676b239ac2c32ae5ba7ee961254ef 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 7a4258e1..1f9f350c 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 3d87dba56d2706eb725e91a9a4735208d4402cf0 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 0820e15a..1eae4782 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 4d22f57ec9e881f861ffa146a6dd06d573f20463 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 1eae4782..abafcc1b 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 556dd88e8df9577c65bfa0a661cc85d7e23a8eb8 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 1f9f350c..041e88f7 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 2e8730b49d4d44e64f7675627717e13c39bf8a8f 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 abafcc1b..72f82b63 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