Skip to content

Commit 7462a5e

Browse files
committed
[RNE Rewrite] chore: enable readability clang-tidy checks
Turn on the readability-* group (completing the check set). Fix isolate-declaration (split the multi-declarations onto separate lines). Exclude the opinionated checks: - readability-identifier-length — short names (i, rt, h, w) are idiomatic here - readability-math-missing-parentheses — flags standard array-offset arithmetic - readability-function-cognitive-complexity — the JSI get() dispatchers and the image/tensor kernels are inherently above the threshold - readability-uppercase-literal-suffix — the codebase uses lowercase (1.0f) - readability-magic-numbers — opinionated (matches the cppcoreguidelines exclusion)
1 parent d7e6d6f commit 7462a5e

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

‎packages/react-native-executorch/.clang-tidy‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
# (it flags RAII lock guards as const-able); not enforced going forward
2727
# modernize-use-trailing-return-type — the codebase uses traditional return types
2828
# modernize-return-braced-init-list — `return {…}` hides the (JSI) return type
29+
# readability-identifier-length — short names (i, rt, h, w, …) are idiomatic here
30+
# readability-math-missing-parentheses — flags standard array-offset arithmetic
31+
# readability-function-cognitive-complexity — the JSI get() dispatchers and the
32+
# image/tensor kernels are inherently above the threshold
33+
# readability-uppercase-literal-suffix — the codebase uses lowercase (1.0f) consistently
34+
# readability-magic-numbers — opinionated (same as cppcoreguidelines-avoid-magic-numbers)
2935
Checks: >
3036
-*,
3137
bugprone-*,
@@ -36,6 +42,7 @@ Checks: >
3642
llvm-*,
3743
misc-*,
3844
modernize-*,
45+
readability-*,
3946
-bugprone-easily-swappable-parameters,
4047
-performance-enum-size,
4148
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
@@ -50,7 +57,12 @@ Checks: >
5057
-misc-non-private-member-variables-in-classes,
5158
-misc-const-correctness,
5259
-modernize-use-trailing-return-type,
53-
-modernize-return-braced-init-list
60+
-modernize-return-braced-init-list,
61+
-readability-identifier-length,
62+
-readability-math-missing-parentheses,
63+
-readability-function-cognitive-complexity,
64+
-readability-uppercase-literal-suffix,
65+
-readability-magic-numbers
5466
5567
# Restrict analysis to this package's own cpp/ tree. Anchored on the full package
5668
# path so it can never match an unrelated directory that merely contains "cpp"

‎packages/react-native-executorch/cpp/extensions/cv/image_ops.cpp‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ void install_resize(jsi::Runtime &rt, jsi::Object &module) {
148148
const int32_t dstH = dst->shape_[0];
149149
const int32_t dstW = dst->shape_[1];
150150

151-
int cvType{}, interpFlag{};
151+
int cvType{};
152+
int interpFlag{};
152153
try {
153154
cvType = CV_MAKETYPE(dtypeToCvDepth(src->dtype_), channels);
154155
interpFlag = interpToFlag(interp);
@@ -297,7 +298,9 @@ void install_cvtColor(jsi::Runtime &rt, jsi::Object &module) {
297298
const int32_t srcC = src->shape_[2];
298299
const int32_t dstC = dst->shape_[2];
299300

300-
int cvSrcType{}, cvDstType{}, flag{};
301+
int cvSrcType{};
302+
int cvDstType{};
303+
int flag{};
301304
try {
302305
cvSrcType = CV_MAKETYPE(dtypeToCvDepth(src->dtype_), srcC);
303306
cvDstType = CV_MAKETYPE(dtypeToCvDepth(dst->dtype_), dstC);

‎packages/react-native-executorch/cpp/extensions/math/operations.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ void install_argmax(jsi::Runtime &rt, jsi::Object &module) {
270270
throw jsi::JSError(rt, "argmax: axis dimension must be greater than zero");
271271
}
272272

273-
size_t outer = 1, inner = 1;
273+
size_t outer = 1;
274+
size_t inner = 1;
274275
for (size_t i = 0; std::cmp_less(i, axis); ++i) {
275276
outer *= static_cast<size_t>(src->shape_[i]);
276277
}

0 commit comments

Comments
 (0)