Skip to content

Fix low SonarQube issues - #334

Merged
eightysix-86 merged 6 commits into
mainfrom
fix/sonarqube-issues-low
Dec 18, 2025
Merged

eightysix-86 merged 6 commits into
mainfrom
fix/sonarqube-issues-low

Conversation

@eightysix-86

@eightysix-86 eightysix-86 commented Dec 17, 2025 •

Copy link
Copy Markdown
Contributor

Goal

This pull request addresses and fixes low-priority SonarQube issues identified in the codebase. The goal is to improve code quality, ensure compliance with best practices, and remove redundant or unnecessary elements in the code while keeping the application's functionality intact.

Changes (All low SonarQube issues)

  • Test files:

    • Remove unused or redundant assert(hasText("read")) in LatestNewsCardTest.kt
    • Add HazardMarkerTestInjectables dependency injection support in MapIconTest.kt to simplify function parameters
    • Remove obsolete setUpHazardMarker function and unused test cases in MapIconTest.kt
  • Authentication:

    • Simplifie return statements for Result.success and Result.failure in AuthRepositoryFirebase.kt
  • UI components:

    • Remove hardcoded colors from DashboardEmergencyContactsCard.kt
    • Adjust string resource references in LatestNewsCard.kt to improve localization support and clarify text
    • Update string resources in strings.xml and removed unused or redundant entries
  • ViewModels:

    • Uncomment unused HiltViewModel annotations in LatestNewsViewModel.kt and GlobalErrorViewModel.kt for future dependency injection enhancements
  • General cleanup:

    • Remove unused theme-related and error string resources in strings.xml
    • Delete redundant color definitions from colors.xml

Notes

Some part of the refactoring has been assisted by AI, especially the refactoring of methods (eg: HazardMarker)

- Renamed `latest_news` to `latest_news_title`.
- Replaced the hardcoded "read" link text with the `latest_news_read_article` string resource.
- Substituted the hardcoded content description for the event image with `latest_news_event_image_description`.
- Updated `LatestNewsCardTest` to remove assertions on the now-localized "read" text.
- Cleaned up several unused string and color resources.
fix info SonarQube issues

- Clean up `LatestNewsViewModel` and `GlobalErrorViewModel` by removing commented-out Hilt annotations and unused private properties.
- Remove a TODO comment about hardcoded colors in `DashboardEmergencyContactsCard`.
- Delete a TODO comment from the `onCapabilitiesChanged` function in `DangerModeCardViewModel`.
@eightysix-86 eightysix-86 added this to the M3 milestone Dec 17, 2025
@eightysix-86 eightysix-86 self-assigned this Dec 17, 2025
@eightysix-86 eightysix-86 added the refactoring Refactoring of previous code label Dec 17, 2025
@eightysix-86 eightysix-86 linked an issue Dec 17, 2025 that may be closed by this pull request
medium SonarQube issues

Refactor the `HazardMarker` composable by introducing the `HazardMarkerTestInjectables` data class. This change consolidates several testing-related dependencies into a single parameter, simplifying the function's signature and improving test code readability.

The `AuthRepositoryFirebase` has also been slightly refactored for conciseness by removing explicit `return` statements from `Result` blocks.
@eightysix-86
eightysix-86 marked this pull request as ready for review December 18, 2025 00:57
@NailLaraqui
NailLaraqui self-requested a review December 18, 2025 01:02

@NailLaraqui NailLaraqui left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

# Conflicts:
#	app/src/main/java/com/github/warnastrophy/core/ui/features/dashboard/DangerModeCardViewModel.kt
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
70.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@eightysix-86
eightysix-86 merged commit 48e2149 into main Dec 18, 2025
1 of 2 checks passed
@eightysix-86
eightysix-86 deleted the fix/sonarqube-issues-low branch December 18, 2025 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Refactoring of previous code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Various small fixes and SonarQube issues resolving

2 participants