-
Notifications
You must be signed in to change notification settings - Fork 200
Fix: Corrected Margin of Success Label Retrieval #8237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8237 +/- ##
============================================
- Coverage 11.72% 11.72% -0.01%
- Complexity 7532 7534 +2
============================================
Files 1271 1271
Lines 162724 162749 +25
Branches 24515 24520 +5
============================================
+ Hits 19082 19083 +1
- Misses 141644 141666 +22
- Partials 1998 2000 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where margin of success labels were not being retrieved correctly from the resource bundle. The old implementation used numeric margin values (e.g., 4.label) as resource keys, but the resource bundle actually uses enum names (e.g., SPECTACULAR.label) as keys. The PR also refactors the MarginOfSuccess enum by converting unnecessary static methods to instance methods.
Key changes:
- Fixed label retrieval by adding a
lookupNamefield to store the correct resource bundle key - Refactored three static methods (
getMarginValue,getMarginOfSuccessString,getMarginOfSuccessColor) to instance methods (getValue,getLabel,getColor) - Added a test to validate resource key references for all enum values
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| MekHQ/src/mekhq/campaign/personnel/skills/enums/MarginOfSuccess.java | Fixed label retrieval by adding lookupName parameter and field; converted static methods to instance methods |
| MekHQ/unittests/mekhq/campaign/personnel/skills/enums/MarginOfSuccessTest.java | Added new test to validate resource bundle keys for all enum values |
| MekHQ/src/mekhq/campaign/personnel/skills/SkillCheckUtility.java | Updated to use instance methods instead of removed static methods; removed obsolete static imports |
| MekHQ/unittests/mekhq/campaign/personnel/skills/SkillCheckUtilityTest.java | Updated test to use instance methods; removed obsolete static import |
| MekHQ/src/mekhq/campaign/personnel/skills/AttributeCheckUtility.java | Updated to use instance methods instead of removed static methods; removed obsolete static imports |
| MekHQ/src/mekhq/campaign/personnel/skills/EscapeSkills.java | Updated to use getColor() instance method instead of static getMarginOfSuccessColor() |
| MekHQ/src/mekhq/campaign/personnel/skills/Appraisal.java | Updated to use getColor() instance method instead of static getMarginOfSuccessColor() |
| MekHQ/src/mekhq/campaign/personnel/education/TrainingCombatTeams.java | Updated to use instance methods (getValue(), getLabel(), getColor()) instead of removed static methods; removed obsolete static imports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MekHQ/unittests/mekhq/campaign/personnel/skills/enums/MarginOfSuccessTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
This PR fixes the following issue:
While I was doing so I also did the following: