Skip to content

Commit d37e2ee

Browse files
HipsterBrownclaude
andcommitted
chore(sdk): brace single-line ifs in vision proto-conv
clang-tidy's readability-braces-around-statements is treated as an error in CI. The Vision::detection to_proto / from_proto helpers had 16 single-line `if (cond) stmt;` patterns left over from the initial draft. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e00432c commit d37e2ee

1 file changed

Lines changed: 32 additions & 16 deletions

File tree

src/viam/sdk/services/private/vision.cpp

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,45 +27,61 @@ namespace vpb = ::viam::service::vision::v1;
2727

2828
vpb::Detection to_proto(const Vision::detection& d) {
2929
vpb::Detection out;
30-
if (d.x_min)
30+
if (d.x_min) {
3131
out.set_x_min(*d.x_min);
32-
if (d.y_min)
32+
}
33+
if (d.y_min) {
3334
out.set_y_min(*d.y_min);
34-
if (d.x_max)
35+
}
36+
if (d.x_max) {
3537
out.set_x_max(*d.x_max);
36-
if (d.y_max)
38+
}
39+
if (d.y_max) {
3740
out.set_y_max(*d.y_max);
38-
if (d.x_min_normalized)
41+
}
42+
if (d.x_min_normalized) {
3943
out.set_x_min_normalized(*d.x_min_normalized);
40-
if (d.y_min_normalized)
44+
}
45+
if (d.y_min_normalized) {
4146
out.set_y_min_normalized(*d.y_min_normalized);
42-
if (d.x_max_normalized)
47+
}
48+
if (d.x_max_normalized) {
4349
out.set_x_max_normalized(*d.x_max_normalized);
44-
if (d.y_max_normalized)
50+
}
51+
if (d.y_max_normalized) {
4552
out.set_y_max_normalized(*d.y_max_normalized);
53+
}
4654
out.set_class_name(d.class_name);
4755
out.set_confidence(d.confidence);
4856
return out;
4957
}
5058

5159
Vision::detection from_proto(const vpb::Detection& p) {
5260
Vision::detection out;
53-
if (p.has_x_min())
61+
if (p.has_x_min()) {
5462
out.x_min = p.x_min();
55-
if (p.has_y_min())
63+
}
64+
if (p.has_y_min()) {
5665
out.y_min = p.y_min();
57-
if (p.has_x_max())
66+
}
67+
if (p.has_x_max()) {
5868
out.x_max = p.x_max();
59-
if (p.has_y_max())
69+
}
70+
if (p.has_y_max()) {
6071
out.y_max = p.y_max();
61-
if (p.has_x_min_normalized())
72+
}
73+
if (p.has_x_min_normalized()) {
6274
out.x_min_normalized = p.x_min_normalized();
63-
if (p.has_y_min_normalized())
75+
}
76+
if (p.has_y_min_normalized()) {
6477
out.y_min_normalized = p.y_min_normalized();
65-
if (p.has_x_max_normalized())
78+
}
79+
if (p.has_x_max_normalized()) {
6680
out.x_max_normalized = p.x_max_normalized();
67-
if (p.has_y_max_normalized())
81+
}
82+
if (p.has_y_max_normalized()) {
6883
out.y_max_normalized = p.y_max_normalized();
84+
}
6985
out.class_name = p.class_name();
7086
out.confidence = p.confidence();
7187
return out;

0 commit comments

Comments
 (0)