Skip to content

Conversation

Thalley
Copy link
Contributor

@Thalley Thalley commented Sep 6, 2025

Split the subgroup validation from
bt_bap_base_get_base_from_ad into a new function
base_pull_subgroup to make the function simpler and make Sonarcloud happy.

}

if (net_buf->len < BASE_CODEC_ID_SIZE) {
LOG_DBG("Invalid BASE length: %u", net_buf->size);
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we have a lot of duplicate LOG_DBG("Invalid BASE length: %u", net_buf->size);, it would be hard to identify which one it is from debug log.
It would be better to add more info, such as:
LOG_DBG("Invalid BASE length: %u, for codec id", net_buf->size);

@Thalley Thalley requested review from ChangNice and Copilot and removed request for ChangNice September 9, 2025 07:58
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

Refactors the bt_bap_base_get_base_from_ad function by extracting subgroup validation logic into a separate base_pull_subgroup function to reduce complexity and address Sonarcloud code quality concerns.

  • Extracts subgroup parsing logic into a new static function base_pull_subgroup
  • Simplifies the main function by replacing inline validation with function calls
  • Updates bt_bap_base_foreach_subgroup to use the new helper function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Split the subgroup validation from
bt_bap_base_get_base_from_ad into a new function
base_pull_subgroup to make the function simpler and
make Sonarcloud happy.

The new function, base_pull_subgroup, is also used
in the bt_bap_base_foreach_subgroup to reduce
code duplication.

Signed-off-by: Emil Gydesen <[email protected]>
Copy link

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.

4 participants