ethz-asl / grid_map_geo

Geolocalization for grid map using GDAL.
BSD 3-Clause "New" or "Revised" License
141 stars 19 forks source link

Use available clang-format version for Ubuntu 22 #45

Closed Ryanf55 closed 9 months ago

Ryanf55 commented 9 months ago

Purpose

ROS2 (on humble) comes with clang-format 14, but the scripts hard code clang-format 6. You can't install it in Ubuntu 22. Thus, it's time to migrate up a few versions.

$ sudo apt install clang-format-6.0
[sudo] password for ryan: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package clang-format-6.0
E: Couldn't find any package by glob 'clang-format-6.0'

Risk

Note - running version 14 results in the following diff (small):

ryan@B650-970:~/Dev/ros2_ws/src/grid_map_geo/Tools$ ./check_code_format.sh 
diff --git a/include/grid_map_geo/grid_map_geo.hpp b/include/grid_map_geo/grid_map_geo.hpp
index 7d293b6..6e98f78 100644
--- a/include/grid_map_geo/grid_map_geo.hpp
+++ b/include/grid_map_geo/grid_map_geo.hpp
@@ -37,2 +36,0 @@
-#include "grid_map_geo/transform.hpp"
-
@@ -41,0 +40,2 @@
+#include "grid_map_geo/transform.hpp"
+
diff --git a/src/test_tif_loader.cpp b/src/test_tif_loader.cpp
index a1dddc4..4951269 100644
--- a/src/test_tif_loader.cpp
+++ b/src/test_tif_loader.cpp
@@ -41,4 +40,0 @@
-
-#include "rclcpp/rclcpp.hpp"
-#include "std_msgs/msg/string.hpp"
-
@@ -46,0 +43,2 @@
+#include "rclcpp/rclcpp.hpp"
+#include "std_msgs/msg/string.hpp"
diff --git a/test/test_grid_map_geo.cpp b/test/test_grid_map_geo.cpp
index cb1c005..738be37 100644
--- a/test/test_grid_map_geo.cpp
+++ b/test/test_grid_map_geo.cpp
@@ -1,2 +0,0 @@
-#include "grid_map_geo/transform.hpp"
-
@@ -3,0 +2 @@
+
@@ -5,0 +5,2 @@
+#include "grid_map_geo/transform.hpp"
+
Code style check failed, please run clang-format (e.g. with scripts/fix_code_style.sh)

I've applied the diff, and we now enfoce the same version of clang that is installed on Ubuntu 22.

Ryanf55 commented 9 months ago

Thanks for fixing this!

Was meaning to do this for a while now.

Would be great if you could rebase?

Done! Conflicts are resolved.

Jaeyoung-Lim commented 9 months ago

@Ryanf55 Any ideas for the build failures?

Ryanf55 commented 9 months ago

@Ryanf55 Any ideas for the build failures

Oops, yep. I'll put it in draft and re-request review when it's fixed.

Ryanf55 commented 9 months ago

Ready for final review. Let's try to get this in soon to fix all the style problems and enforce clean diffs after this.