Skip to content

Commit 8b8b7bb

Browse files
authored
Uncrustify initial (#137)
Workflows Update Cpplint Lint Updates Update Update
1 parent ff4c4c4 commit 8b8b7bb

77 files changed

Lines changed: 5984 additions & 6470 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ jobs:
3030
pip3 install gcovr
3131
3232
- name: Build
33-
run: . /opt/ros/foxy/setup.sh && colcon build --symlink-install --cmake-args -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="-ftest-coverage --coverage -fno-inline -fno-inline-small-functions -fno-default-inline" -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON -DCMAKE_C_FLAGS="-ftest-coverage --coverage -fno-inline -fno-inline-small-functions -fno-default-inline" -DCMAKE_C_OUTPUT_EXTENSION_REPLACE=ON
33+
run: . /opt/ros/$ROS_DISTRO/setup.sh && colcon build --symlink-install --cmake-args -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="-ftest-coverage --coverage -fno-inline -fno-inline-small-functions -fno-default-inline" -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON -DCMAKE_C_FLAGS="-ftest-coverage --coverage -fno-inline -fno-inline-small-functions -fno-default-inline" -DCMAKE_C_OUTPUT_EXTENSION_REPLACE=ON
3434

3535
- name: Test
3636
run: |
37-
. /opt/ros/foxy/setup.sh && . /uros_ws/install/local_setup.sh && ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888 -d -v6 &
37+
. /opt/ros/$ROS_DISTRO/setup.sh && . /uros_ws/install/local_setup.sh && ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888 -d -v4 &
3838
sleep 1
39-
. /opt/ros/foxy/setup.sh && . install/local_setup.sh
40-
colcon test --packages-select=rmw_microxrcedds --return-code-on-test-failure --ctest-args -E "(cpplint)|(lint_cmake)|(uncrustify)|(xmllint)"
39+
. /opt/ros/$ROS_DISTRO/setup.sh && . install/local_setup.sh
40+
colcon test --event-handlers console_direct+ --packages-select=rmw_microxrcedds --return-code-on-test-failure
4141
./build/rmw_microxrcedds/test/test-sizes 2> memanalisys_out
4242
4343
- name: Static memory
@@ -56,28 +56,3 @@ jobs:
5656
curl -s https://codecov.io/bash -o codecov.bash && chmod +x codecov.bash
5757
./codecov.bash -t ${{ secrets.CODECOV_TOKEN }}
5858
59-
rmw_microxrcedds_uncrustify:
60-
runs-on: ubuntu-20.04
61-
container: microros/micro-ros-agent:foxy
62-
63-
steps:
64-
- uses: actions/checkout@v2
65-
with:
66-
path: src/rmw-microxrcedds
67-
68-
- name: Uncrustify
69-
run: |
70-
# Install Uncrustify
71-
git clone https://github.com/uncrustify/uncrustify.git --branch uncrustify-0.72.0 --single-branch uncrustify
72-
mkdir -p uncrustify/build
73-
cd uncrustify/build
74-
cmake -DCMAKE_INSTALL_PREFIX=../install ..
75-
cmake --build . --target install -- -j$(nproc)
76-
cd ../..
77-
export PATH=${PWD}/uncrustify/install/bin:$PATH
78-
# Check Uncrustify
79-
cd src/rmw-microxrcedds/rmw_microxrcedds_c
80-
curl -l https://raw.githubusercontent.com/eProsima/cpp-style/master/uncrustify.cfg -o uncrustify.cfg
81-
find src test include \( -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" \) -exec uncrustify -c uncrustify.cfg --check {} +
82-
83-

.github/workflows/uncrustify.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
run_uncrustify:
99
if: contains(github.event.comment.html_url, '/pull/') && contains(github.event.comment.body, 'Marie Kondo')
1010
runs-on: ubuntu-latest
11+
container: ros:foxy
1112
steps:
1213
- uses: xt0rted/pull-request-comment-branch@v1
1314
id: comment-branch
@@ -19,19 +20,10 @@ jobs:
1920
path: repo
2021
ref: ${{ steps.comment-branch.outputs.head_ref }}
2122
- name: Style
22-
run: |
23-
# Install Uncrustify
24-
git clone https://github.com/uncrustify/uncrustify.git --branch uncrustify-0.72.0 --single-branch uncrustify
25-
mkdir -p uncrustify/build
26-
cd uncrustify/build
27-
cmake -DCMAKE_INSTALL_PREFIX=../install ..
28-
cmake --build . --target install -- -j$(nproc)
29-
cd ../..
30-
export PATH=${PWD}/uncrustify/install/bin:$PATH
23+
run: |
3124
# Exec Uncrustify
3225
cd repo
33-
curl -l https://raw.githubusercontent.com/eProsima/cpp-style/master/uncrustify.cfg -o uncrustify.cfg
34-
find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" \) -exec uncrustify -c uncrustify.cfg --replace --no-backup {} +
26+
. /opt/ros/$ROS_DISTRO/setup.sh && ament_uncrustify --reformat
3527
# Commit
3628
git config user.name "GitHub Actions Bot"
3729
git config user.email "<>"

rmw_microxrcedds_c/CMakeLists.txt

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ project(rmw_microxrcedds
2121
${PACKAGE_VERSION}
2222
LANGUAGES
2323
C
24-
)
24+
)
2525

2626
find_package(ament_cmake_ros REQUIRED)
2727
find_package(rcutils REQUIRED)
@@ -34,9 +34,8 @@ find_package(rmw REQUIRED)
3434

3535
# Build options
3636
option(BUILD_DOCUMENTATION "Use doxygen to create product documentation" OFF)
37-
38-
# RMW profile options
3937
option(RMW_UXRCE_GRAPH "Allows to perform graph-related operations to the user" OFF)
38+
4039
if(RMW_UXRCE_GRAPH)
4140
find_package(micro_ros_msgs REQUIRED)
4241
endif()
@@ -159,7 +158,7 @@ set(SRCS
159158
$<$<BOOL:${RMW_UXRCE_TRANSPORT_UDP}>:src/rmw_microros/discovery.c>
160159
$<$<BOOL:${RMW_UXRCE_TRANSPORT_CUSTOM}>:src/rmw_microros/custom_transport.c>
161160
$<$<BOOL:${RMW_UXRCE_GRAPH}>:src/rmw_graph.c>
162-
)
161+
)
163162

164163
add_library(${PROJECT_NAME}
165164
${SRCS})
@@ -175,7 +174,7 @@ if(RMW_UXRCE_GRAPH)
175174

176175
ament_target_dependencies(${PROJECT_NAME}
177176
"micro_ros_msgs"
178-
)
177+
)
179178
endif()
180179

181180
target_link_libraries(${PROJECT_NAME}
@@ -189,44 +188,47 @@ find_package(rosidl_typesupport_microxrcedds_c)
189188
if(rosidl_typesupport_microxrcedds_c_FOUND)
190189
ament_target_dependencies(${PROJECT_NAME}
191190
"rosidl_typesupport_microxrcedds_c"
192-
)
191+
)
193192
target_compile_definitions(${PROJECT_NAME}
194193
PUBLIC
195194
HAVE_C_TYPESUPPORT
196-
)
195+
)
197196
find_package(rosidl_typesupport_microxrcedds_cpp)
198197
else()
199198
find_package(rosidl_typesupport_microxrcedds_cpp REQUIRED)
200199
endif()
201200
if(rosidl_typesupport_microxrcedds_cpp_FOUND)
202201
ament_target_dependencies(${PROJECT_NAME}
203202
"rosidl_typesupport_microxrcedds_cpp"
204-
)
203+
)
205204
target_compile_definitions(${PROJECT_NAME}
206205
PUBLIC
207206
HAVE_CPP_TYPESUPPORT
208-
)
207+
)
209208
endif()
210209

211210
ament_target_dependencies(${PROJECT_NAME}
212211
"rcutils"
213212
"rmw"
214213
"microxrcedds_client"
215-
)
214+
)
216215

217216
configure_rmw_library(${PROJECT_NAME})
218217

219218
target_include_directories(${PROJECT_NAME}
220219
PUBLIC
221220
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
222-
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)
221+
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
222+
PRIVATE
223+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
224+
)
223225

224226
set_target_properties(${PROJECT_NAME} PROPERTIES
225227
C_STANDARD
226228
99
227229
C_STANDARD_REQUIRED
228230
YES
229-
)
231+
)
230232

231233
target_compile_options(${PROJECT_NAME}
232234
PRIVATE
@@ -237,7 +239,7 @@ target_compile_options(${PROJECT_NAME}
237239
$<$<C_COMPILER_ID:GNU>:$<$<VERSION_GREATER:$<C_COMPILER_VERSION>,8.1>:-Wcast-align=strict>>
238240
$<$<C_COMPILER_ID:GNU>:-Wvla>
239241
$<$<C_COMPILER_ID:MSVC>:/Wall>
240-
)
242+
)
241243

242244
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/include)
243245

@@ -250,7 +252,7 @@ ament_export_dependencies(
250252
rcutils
251253
rmw
252254
microxrcedds_client
253-
)
255+
)
254256

255257
if(rosidl_typesupport_microxrcedds_c_FOUND)
256258
ament_export_dependencies(rosidl_typesupport_microxrcedds_c)
@@ -261,13 +263,13 @@ if(rosidl_typesupport_microxrcedds_cpp_FOUND)
261263
set(implementations
262264
${implementations}
263265
"cpp:rosidl_typesupport_cpp:rosidl_typesupport_microxrcedds_cpp"
264-
)
266+
)
265267
endif()
266268

267269
register_rmw_implementation(${implementations})
268270

269271
if(BUILD_TESTING)
270-
# Pedantic in CI
272+
# Pedantic in CI
271273
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
272274
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
273275

@@ -324,15 +326,15 @@ install(
324326
${PROJECT_SOURCE_DIR}/include/
325327
DESTINATION
326328
include
327-
)
329+
)
328330

329331
# Install config.h file.
330332
install(
331333
FILES
332334
${PROJECT_BINARY_DIR}/include/rmw_microxrcedds_c/config.h
333335
DESTINATION
334336
include/rmw_microxrcedds_c
335-
)
337+
)
336338

337339
# Install library.
338340
install(
@@ -344,12 +346,11 @@ install(
344346
lib
345347
RUNTIME DESTINATION
346348
bin
347-
)
349+
)
348350

349351
if(BUILD_DOCUMENTATION)
350352
# Instalation of doxygen files
351353
install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/api_reference
352354
DESTINATION ${DOC_INSTALL_DIR}
353-
COMPONENT documentation
354-
)
355+
COMPONENT documentation)
355356
endif()

rmw_microxrcedds_c/include/rmw_microros/continous_serialization.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
#if defined(__cplusplus)
2929
extern "C"
3030
{
31-
#endif // if defined(__cplusplus)
31+
#endif // if defined(__cplusplus)
3232

3333
typedef void (* rmw_uros_continous_serialization_size)(
34-
uint32_t* topic_length);
34+
uint32_t * topic_length);
3535
typedef void (* rmw_uros_continous_serialization)(
36-
ucdrBuffer* ucdr);
36+
ucdrBuffer * ucdr);
3737

3838
/** \addtogroup rmw micro-ROS RMW API
3939
* @{
@@ -47,14 +47,14 @@ typedef void (* rmw_uros_continous_serialization)(
4747
* \param[in] serialization_cb callback that should serialize the user part of the message
4848
*/
4949
void rmw_uros_set_continous_serialization_callbacks(
50-
rmw_publisher_t* publisher,
51-
rmw_uros_continous_serialization_size size_cb,
52-
rmw_uros_continous_serialization serialization_cb);
50+
rmw_publisher_t * publisher,
51+
rmw_uros_continous_serialization_size size_cb,
52+
rmw_uros_continous_serialization serialization_cb);
5353

5454
/** @}*/
5555

5656
#if defined(__cplusplus)
5757
}
58-
#endif // if defined(__cplusplus)
58+
#endif // if defined(__cplusplus)
5959

6060
#endif // RMW_MICROROS__CONTINOUS_SERIALIZATION_H_

rmw_microxrcedds_c/include/rmw_microros/custom_transport.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* @file
1717
*/
1818

19-
#ifndef RMW_MICROROS__CUSTOM_TRANSPORTS_H_
20-
#define RMW_MICROROS__CUSTOM_TRANSPORTS_H_
19+
#ifndef RMW_MICROROS__CUSTOM_TRANSPORT_H_
20+
#define RMW_MICROROS__CUSTOM_TRANSPORT_H_
2121

2222
#include <rmw/rmw.h>
2323
#include <rmw/ret_types.h>
@@ -30,7 +30,7 @@
3030
#if defined(__cplusplus)
3131
extern "C"
3232
{
33-
#endif // if defined(__cplusplus)
33+
#endif // if defined(__cplusplus)
3434

3535
/** \addtogroup rmw micro-ROS RMW API
3636
* @{
@@ -49,17 +49,17 @@ extern "C"
4949
* \return RMW_RET_ERROR If invalid.
5050
*/
5151
rmw_ret_t rmw_uros_set_custom_transport(
52-
bool framing,
53-
void* args,
54-
open_custom_func open_cb,
55-
close_custom_func close_cb,
56-
write_custom_func write_cb,
57-
read_custom_func read_cb);
52+
bool framing,
53+
void * args,
54+
open_custom_func open_cb,
55+
close_custom_func close_cb,
56+
write_custom_func write_cb,
57+
read_custom_func read_cb);
5858

5959
/** @}*/
6060

6161
#if defined(__cplusplus)
6262
}
63-
#endif // if defined(__cplusplus)
63+
#endif // if defined(__cplusplus)
6464

65-
#endif // RMW_MICROROS__CUSTOM_TRANSPORTS_H_
65+
#endif // RMW_MICROROS__CUSTOM_TRANSPORT_H_

rmw_microxrcedds_c/include/rmw_microros/discovery.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#if defined(__cplusplus)
2929
extern "C"
3030
{
31-
#endif // if defined(__cplusplus)
31+
#endif // if defined(__cplusplus)
3232

3333
/** \addtogroup rmw micro-ROS RMW API
3434
* @{
@@ -43,12 +43,12 @@ extern "C"
4343
* \return RMW_RET_INVALID_ARGUMENT If rmw_init_options is not valid or unexpected arguments.
4444
*/
4545
rmw_ret_t rmw_uros_discover_agent(
46-
rmw_init_options_t* rmw_options);
46+
rmw_init_options_t * rmw_options);
4747

4848
/** @}*/
4949

5050
#if defined(__cplusplus)
5151
}
52-
#endif // if defined(__cplusplus)
52+
#endif // if defined(__cplusplus)
5353

5454
#endif // RMW_MICROROS__DISCOVERY_H_

0 commit comments

Comments
 (0)