Skip to content

fix(clang-tidy): re-enable bugprone-unused-return-value#12559

Open
vish0012 wants to merge 1 commit intoautowarefoundation:mainfrom
vish0012:fix/clang-tidy-unused-return-value
Open

fix(clang-tidy): re-enable bugprone-unused-return-value#12559
vish0012 wants to merge 1 commit intoautowarefoundation:mainfrom
vish0012:fix/clang-tidy-unused-return-value

Conversation

@vish0012
Copy link
Copy Markdown
Contributor

@vish0012 vish0012 commented May 8, 2026

Description

Re-enables bugprone-unused-return-value in .clang-tidy-ci.

The check was suppressed in #12431. This PR addresses the 2 reported errors in system/autoware_system_monitor listed in #12450.

Refs #12450

Approach

Both errors came from Boost.Asio calls where the returned boost::system::error_code was ignored, even though the code already had an error_code variable and checked it immediately afterward.

This PR assigns the returned value back to error_code, preserving the existing logic while satisfying bugprone-unused-return-value.

Changed calls:

error_code = acceptor_->accept(*socket_, error_code);
error_code = socket_->connect(endpoint, error_code);

Affected files:

  • system/autoware_system_monitor/reader/traffic_reader/traffic_reader_service.cpp
  • system/autoware_system_monitor/src/net_monitor/net_monitor.cpp

How to reproduce

From the colcon workspace root:

cd ~/autoware_clang_tidy
source /opt/ros/humble/setup.bash

mkdir -p /tmp/clang-tidy-result

colcon build --packages-up-to autoware_system_monitor \
  --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1

run-clang-tidy -p build/ \
  -config="$(cat src/autoware_universe/.clang-tidy-ci)" \
  -export-fixes /tmp/clang-tidy-result/fixes.yaml \
  -j $(nproc) autoware_system_monitor \
  > /tmp/clang-tidy-result/report.log 2>&1

To check the reported errors:

grep -n "bugprone-unused-return-value" /tmp/clang-tidy-result/report.log | grep "error:" || echo "0 unused-return-value errors"

Verification

Before the fix, the following 2 errors were reproduced:

system/autoware_system_monitor/reader/traffic_reader/traffic_reader_service.cpp:83
system/autoware_system_monitor/src/net_monitor/net_monitor.cpp:667

After the fix, autoware_system_monitor builds successfully and run-clang-tidy reports:

0 unused-return-value errors

Notes

The only .clang-tidy-ci change is removing the suppression line for this check:

-  -bugprone-unused-return-value"

Signed-off-by: Vishal Chauhan <40782713+vish0012@users.noreply.github.com>
@vish0012 vish0012 requested a review from mitsudome-r May 8, 2026 02:27
@github-actions github-actions Bot added the component:system System design and integration. (auto-assigned) label May 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@vish0012 vish0012 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:system System design and integration. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

1 participant