| Files | Last commit | Last update |
|---|---|---|
refactor(format): switch C and C++ sources to the OpenHarmony code style What: - Replace .clang-format with the OpenHarmony style required by the daily code check: 4-space indent, 120 columns, function left brace on its own line, braces on every if/for/while body, case labels indented. - Run clang-format 18 over all hand-written C and C++ files; the files generated by ibmw_gen (the kept *_gen samples and the template project) are left for the generator change that follows, except the headers the generator copies verbatim from the reformatted sources. - plain_dds_pubsub_type.h: the Fast DDS version #if now only switches the function signature, so both branches share one body brace; clang-format could not indent the old form. - Tests that search source text for a fixed indentation now use the new indentation or ignore it. Why: About 32 000 of the reported findings are layout rules (indentation, brace position, line width) that clang-format handles mechanically. This commit only changes whitespace, adds braces, splits long string literals and sorts using-declarations; a check of every file confirmed no other tokens changed and every #if branch keeps its brace balance. Verification: - Full build with -Werror: no errors; ctest: 75 of 75 passed - pytest src/tools/ibmw_gen/tests: 332 passed, 1 known failure (needs IBMW_BUILD_DIR) - scripts/tests: same results as before the change - scripts/check_clang_format.sh and its tests pass Signed-off-by: fanglinxu <fanglinxu@huawei.com> | 5 days ago | |
refactor(naming): use camelBack for parameters and local variables What: - Rename function parameters, local variables, local constants, static locals, structured bindings, lambda parameters, lambda init-captures and loop variables from snake_case (and UPPER_CASE local constants) to camelBack in the hand-written C/C++ sources, including function pointer parameter names in the C API structs. - Cover code clang-tidy cannot see: inactive #if branches (newer Fast DDS, OHOS, executor back-ends, test hook builds), files not in the CI build (ROS 2 samples, OHOS-only sources, extension tests, bench and selfdev tools) and locals declared inside function-like macros such as IBMW_PKG_MAIN and IBMW_USE_DRIVER(S). - Where a new name would clash with a name already in scope, pick a distinct name: the sample hello_msg.h constructor uses msgId/msg/ts, the shm transport driver's structured bindings are re-captured by name for the older OHOS clang, and one generic DDS type branch reuses the name the other branch already declares. - Update comments that name the parameters (/*name=*/ argument comments, @param, \p and inline prose). - Re-run clang-format on every changed file. - Members, types, enum values, globals, namespace constants, functions, macros, macro parameters and third-party code are unchanged. Why: the daily code check requires camelBack names for parameters and local variables. Verification: clang-tidy readability-identifier-naming for parameters and locals reports 0 findings in repo files; g++ -Wshadow over all build-ci sources shows no new warnings (two fewer); syntax checks of the core metrics/comm trace/test hook and fault/reporter build variants show no new errors; full build-ci build has no errors; ctest 75/75; mw_perf_collect pytest 968 passed, 2 skipped; core metrics pytest 215 passed; clang-format --dry-run -Werror clean on all C/C++ files; license header check 0 changes. Signed-off-by: fanglinxu <fanglinxu@huawei.com> | 5 days ago |
| Files | Last commit | Last update |
|---|---|---|
| 5 days ago | ||
| 5 days ago |