Skip to content

BAP Broadcast Assistant sonarcloud fixes #91589

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Thalley
Copy link
Contributor

@Thalley Thalley commented Jun 13, 2025

Fixes a few issues reported by Sonarcloud

@Thalley Thalley changed the title Bap ba sonarcloud fixes BAP Broadcast Assistant sonarcloud fixes Jun 13, 2025
@Thalley Thalley requested a review from Copilot June 13, 2025 13:38
Copy link

@Copilot 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

This PR addresses SonarCloud-reported maintainability issues in the BAP Broadcast Assistant discovery logic by separating index computation from state-count increment and adding handling for unexpected UUIDs.

  • Split recv_state_cnt increment out of the index assignment to avoid side effects.
  • Introduced an else branch to abort discovery on invalid UUIDs with an error callback.
  • Adjusted log placement around recv_state_cnt.
Comments suppressed due to low confidence (2)

subsys/bluetooth/audio/bap_broadcast_assistant.c:710

  • [nitpick] The log statement prints inst->recv_state_cnt before it is incremented, changing the original behavior. Consider logging idx or moving this log after the inst->recv_state_cnt++ increment to reflect the correct count.
LOG_DBG("Receive State %u", inst->recv_state_cnt);

subsys/bluetooth/audio/bap_broadcast_assistant.c:720

  • Passing 0 for recv_state_count on error hides how many states were discovered before the failure. Consider passing inst->recv_state_cnt to give callers the actual count.
            bap_broadcast_assistant_discover_complete(conn, -EBADMSG, 0);

Thalley added 2 commits July 1, 2025 14:24
If the chrc->uuid is somehow an invalid UUID, we log it and
terminate the discovery procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Sonarcloud does not allow to use the result of a incremental
(++) as an assignment.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
@Thalley Thalley force-pushed the bap_ba_sonarcloud_fixes branch from 39663bf to 1ef7d2f Compare July 1, 2025 12:24
Copy link

sonarqubecloud bot commented Jul 1, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

1 participant