Skip to content

refactor(fullstack): clear sonarcloud code smells and cpd false positive - #368

Merged
GiZano merged 1 commit into
mainfrom
fix/sonar-cleanup
Aug 14, 2026
Merged

refactor(fullstack): clear sonarcloud code smells and cpd false positive#368
GiZano merged 1 commit into
mainfrom
fix/sonar-cleanup

Conversation

@GiZano

@GiZano GiZano commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves the 13 SonarCloud code smells and the 0.8% duplicated lines reported on main after the v1.2.1 release.

Code smells cleared (13 -> 0)

Rule Files Fix
S3358 (nested ternaries) x5 mobile/app/(tabs)/index.tsx, mobile/app/(tabs)/map.tsx, backend/scripts/simulate_zone.py extracted into if/else branches
S3776 (cognitive complexity) x3 backend/src/geo.py, backend/src/timescale.py, backend/src/worker.py extracted helper functions
S1192 (duplicated literal) backend/src/main.py ZONE_NOT_FOUND constant
S1000 (anonymous namespace) firmware/src/GnssModule.h, GnssModule.cpp named namespace quakeguard_gnss
S7755 (index access) mobile/app/(tabs)/index.tsx Array.at(-1)
S4043 (in-place sort) mobile/app/(tabs)/index.tsx toSorted()

Duplication (0.8% -> 0)

  • mobile/theme/mapStyle.ts excluded from CPD analysis: lightMapStyle/darkMapStyle share the same featureType/elementType keys but are two independent palettes — a known structural false positive.

Verification

  • tsc --noEmit: clean
  • Jest (mobile): 23 passed
  • Pytest (backend unit): 104 passed (incl. geo/timescale/worker)
  • No new ruff violations introduced

Changes will land in the v1.2.2 release.

- extract nested ternaries into branches (S3358): mobile dashboard and map, simulate_zone
- reduce cognitive complexity in geo, timescale and worker modules (S3776)
- dedupe 'Zone not found' literal into a constant (S1192)
- name the anonymous namespaces in the gnss firmware module (S1000)
- use Array.at and toSorted in the mobile seismograph window (S7755, S4043)
- exclude the structurally identical map theme palettes from duplication (cpd)
@GiZano
GiZano requested a review from riccardo0731 as a code owner August 14, 2026 21:33
@sonarqubecloud

Copy link
Copy Markdown

@GiZano
GiZano merged commit 5347235 into main Aug 14, 2026
9 checks passed
@GiZano
GiZano deleted the fix/sonar-cleanup branch August 14, 2026 21:37
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.

1 participant