Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/README.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| ----- | ----------- |
Expand Down
6 changes: 4 additions & 2 deletions instructions/java.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -68,14 +69,15 @@ 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.

## 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.