Skip to content

[CODE HEALTH] Fix clang-tidy bugprone warnings#3933

Merged
marcalff merged 6 commits intoopen-telemetry:mainfrom
dbarker:fix_clang_tidy_bugprone_warnings
Mar 14, 2026
Merged

[CODE HEALTH] Fix clang-tidy bugprone warnings#3933
marcalff merged 6 commits intoopen-telemetry:mainfrom
dbarker:fix_clang_tidy_bugprone_warnings

Conversation

@dbarker
Copy link
Member

@dbarker dbarker commented Mar 13, 2026

Fixes clang-tidy bugprone category warnings

  • bugprone-use-after-move
  • bugprone-macro-parentheses
  • bugprone-forward-declaration-namespace
  • bugprone-empty-catch

Changes

Fixes the following warnings


bugprone-use-after-move (1 warnings)

File Line Message
exporters/otlp/src/otlp_grpc_client.cc 208 'request' used after it was forwarded

bugprone-macro-parentheses (2 warnings)

File Line Message
sdk/include/opentelemetry/sdk/common/global_log_handler.h 145 macro argument should be enclosed in parentheses
sdk/include/opentelemetry/sdk/common/global_log_handler.h 155 macro argument should be enclosed in parentheses

bugprone-forward-declaration-namespace (4 warnings)

File Line Message
exporters/otlp/include/opentelemetry/exporters/otlp/otlp_file_client_options.h 22 no definition found for 'Message', but a definition with the same name 'Message' found in another namespace 'testing'
exporters/otlp/include/opentelemetry/exporters/otlp/otlp_file_client_options.h 22 declaration 'Message' is never referenced, but a declaration with the same name found in another namespace 'testing'
sdk/include/opentelemetry/sdk/metrics/exemplar/aligned_histogram_bucket_exemplar_reservoir.h 22 no definition found for 'OrderedAttributeMap', but a definition with the same name 'OrderedAttributeMap' found in another namespace 'opentelemetry::sdk::common'
sdk/include/opentelemetry/sdk/metrics/exemplar/simple_fixed_size_exemplar_reservoir.h 22 no definition found for 'OrderedAttributeMap', but a definition with the same name 'OrderedAttributeMap' found in another namespace 'opentelemetry::sdk::common'

bugprone-empty-catch (1 warnings)

File Line Message
api/include/opentelemetry/plugin/detail/utility.h 31 empty catch statements hide issues; to handle exceptions appropriately, consider re-throwing, handling, or avoiding catch altogether

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@dbarker dbarker changed the title [CODE HEALTH] Fix clang tidy bugprone warnings [CODE HEALTH] Fix clang-tidy bugprone warnings Mar 13, 2026
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.06%. Comparing base (86e5c6d) to head (f1dace3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/include/opentelemetry/plugin/detail/utility.h 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3933      +/-   ##
==========================================
- Coverage   90.07%   90.06%   -0.01%     
==========================================
  Files         226      226              
  Lines        7226     7227       +1     
==========================================
  Hits         6508     6508              
- Misses        718      719       +1     
Files with missing lines Coverage Δ
...lude/opentelemetry/sdk/common/global_log_handler.h 50.00% <ø> (ø)
api/include/opentelemetry/plugin/detail/utility.h 50.00% <0.00%> (-10.00%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker dbarker marked this pull request as ready for review March 14, 2026 00:04
@dbarker dbarker requested a review from a team as a code owner March 14, 2026 00:04
@dbarker dbarker marked this pull request as draft March 14, 2026 00:05
@marcalff
Copy link
Member

@dbarker

Why still draft ? LGTM.

@dbarker dbarker marked this pull request as ready for review March 14, 2026 15:28
@marcalff marcalff merged commit 4307862 into open-telemetry:main Mar 14, 2026
77 of 78 checks passed
malkia added a commit to malkia/opentelemetry-cpp that referenced this pull request Mar 15, 2026
[CODE HEALTH] Fix clang-tidy bugprone warnings (open-telemetry#3933)
@dbarker dbarker deleted the fix_clang_tidy_bugprone_warnings branch March 15, 2026 17:31
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.

2 participants