Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rjhancock
Copy link
Collaborator

General cleanup of issues found with CodeQL tools and IDEA Analysis.

  • Old switch -> New Switch
  • DRYing up a method
  • Mech -> Mek

IDEA CodeQL Updates
Copilot AI review requested due to automatic review settings May 24, 2025 10:27
@rjhancock rjhancock requested a review from a team as a code owner May 24, 2025 10:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

General cleanup of the TipOfTheDay rendering code to remove redundancies and modernize Java syntax.

  • Consolidated AWT imports and removed a redundant cast in tip indexing
  • Replaced classic switch statements with switch expressions
  • Extracted repeated drawing logic into a new helper method
Comments suppressed due to low confidence (2)

megamek/src/megamek/common/util/TipOfTheDay.java:263

  • You're using AffineTransform without an import for java.awt.geom.AffineTransform. Either add the import or fully qualify the class to avoid compilation errors.
AffineTransform gradientTx = AffineTransform.getTranslateInstance(bgRectX, bgRectBottomY);

megamek/src/megamek/common/util/TipOfTheDay.java:387

  • Referencing and assigning to labelDrawX inside a switch expression initializer may not compile, since the target variable isn't definitely assigned in that scope. Consider using a new local variable and yielding its value.
labelDrawX = startX + (currentAvailableTextWidth - labelWidth) / 2; // Center label

@codecov
Copy link

codecov bot commented May 24, 2025

Codecov Report

Attention: Patch coverage is 0% with 43 lines in your changes missing coverage. Please review.

Project coverage is 30.75%. Comparing base (be86a1f) to head (38e42e9).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
megamek/src/megamek/common/util/TipOfTheDay.java 0.00% 43 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7125      +/-   ##
============================================
- Coverage     30.77%   30.75%   -0.02%     
+ Complexity    17004    16987      -17     
============================================
  Files          2941     2941              
  Lines        287710   287680      -30     
  Branches      50224    50223       -1     
============================================
- Hits          88535    88477      -58     
- Misses       192659   192729      +70     
+ Partials       6516     6474      -42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rjhancock rjhancock merged commit bcf9e07 into MegaMek:master May 24, 2025
7 checks passed
@rjhancock rjhancock deleted the useless-comparison-test branch May 24, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants