diff --git a/.github/workflows/format-ubuntu.yml b/.github/workflows/format-ubuntu.yml index 1410019b..767948e4 100644 --- a/.github/workflows/format-ubuntu.yml +++ b/.github/workflows/format-ubuntu.yml @@ -37,8 +37,7 @@ jobs: exit 0 fi set +x -euo pipefail - sudo apt-get update && sudo apt-get install -y clang-format-14 - python -m pip install ruff==0.6.7 + python -m pip install ruff==0.6.7 clang-format==19.1.0 ./scripts/format/clang_format.sh ./scripts/format/python.sh git diff --name-only diff --git a/limap/base/bindings.cc b/limap/base/bindings.cc index bb10f5b3..aaa08488 100644 --- a/limap/base/bindings.cc +++ b/limap/base/bindings.cc @@ -734,8 +734,9 @@ void bind_camera(py::module &m) { .def(py::init>(), py::arg("model_name"), py::arg("cam_id") = -1, py::arg("hw") = std::make_pair(-1, -1)) // empty camera - .def("__copy__", [](const Camera& self) { return Camera(self); }) - .def("__deepcopy__", [](const Camera& self, const py::dict&) { return Camera(self); }) + .def("__copy__", [](const Camera &self) { return Camera(self); }) + .def("__deepcopy__", + [](const Camera &self, const py::dict &) { return Camera(self); }) .def(py::pickle( [](const Camera &input) { // dump return input.as_dict(); @@ -1055,8 +1056,12 @@ void bind_camera(py::module &m) { .def(py::init &>(), py::arg("camviews")) .def(py::init(), py::arg("dict")) .def(py::init(), py::arg("imagecols")) - .def("__copy__", [](const ImageCollection& self) { return ImageCollection(self); }) - .def("__deepcopy__", [](const ImageCollection& self, const py::dict&) { return ImageCollection(self); }) + .def("__copy__", + [](const ImageCollection &self) { return ImageCollection(self); }) + .def("__deepcopy__", + [](const ImageCollection &self, const py::dict &) { + return ImageCollection(self); + }) .def(py::pickle( [](const ImageCollection &input) { // dump return input.as_dict(); diff --git a/limap/base/camera.cc b/limap/base/camera.cc index dbe09299..de73f6d3 100644 --- a/limap/base/camera.cc +++ b/limap/base/camera.cc @@ -37,7 +37,7 @@ bool Camera::IsInitialized() const { return true; } -Camera::Camera(const colmap::Camera& cam) { +Camera::Camera(const colmap::Camera &cam) { camera_id = cam.camera_id; model_id = cam.model_id; params = cam.params; @@ -185,7 +185,7 @@ Camera::Camera(const Camera &cam) { initialized = cam.initialized; } -Camera& Camera::operator=(const Camera& cam) { +Camera &Camera::operator=(const Camera &cam) { if (this != &cam) { camera_id = cam.camera_id; model_id = cam.model_id; diff --git a/limap/base/camera.h b/limap/base/camera.h index 27df5599..1cc80260 100644 --- a/limap/base/camera.h +++ b/limap/base/camera.h @@ -55,8 +55,8 @@ class Camera : public colmap::Camera { Camera(const std::string &model_name, M3D K, int cam_id = -1, std::pair hw = std::make_pair(-1, -1)); Camera(py::dict dict); - Camera(const Camera& cam); - Camera& operator=(const Camera& cam); + Camera(const Camera &cam); + Camera &operator=(const Camera &cam); Camera(int model, int cam_id = -1, std::pair hw = std::make_pair(-1, -1)); // empty camera diff --git a/limap/base/infinite_line.h b/limap/base/infinite_line.h index a98af4d7..e5eaba0e 100644 --- a/limap/base/infinite_line.h +++ b/limap/base/infinite_line.h @@ -68,7 +68,7 @@ class MinimalInfiniteLine3d { public: MinimalInfiniteLine3d() {} MinimalInfiniteLine3d(const Line3d &line) - : MinimalInfiniteLine3d(InfiniteLine3d(line)){}; + : MinimalInfiniteLine3d(InfiniteLine3d(line)) {}; MinimalInfiniteLine3d(const InfiniteLine3d &inf_line); MinimalInfiniteLine3d(const std::vector &values); InfiniteLine3d GetInfiniteLine() const; diff --git a/limap/evaluation/refline_evaluator.h b/limap/evaluation/refline_evaluator.h index 3737f4b0..1fca0978 100644 --- a/limap/evaluation/refline_evaluator.h +++ b/limap/evaluation/refline_evaluator.h @@ -14,7 +14,7 @@ class RefLineEvaluator { public: RefLineEvaluator() {} RefLineEvaluator(const std::vector &ref_lines) - : ref_lines_(ref_lines){}; + : ref_lines_(ref_lines) {}; double SumLength() const; double ComputeRecallRef(const std::vector &lines, diff --git a/requirements.txt b/requirements.txt index c776ad85..520afb04 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,6 +28,7 @@ ninja yacs python-json-logger ruff==0.6.7 +clang-format==19.1.0 ./third-party/pytlsd ./third-party/hawp diff --git a/scripts/format/clang_format.sh b/scripts/format/clang_format.sh index a70a0c8a..d978b650 100755 --- a/scripts/format/clang_format.sh +++ b/scripts/format/clang_format.sh @@ -24,7 +24,7 @@ echo "Found clang-format: $(which ${clang_format})" # Check version version_string=$($clang_format --version | sed -E 's/^.*(\d+\.\d+\.\d+-.*).*$/\1/') -expected_version_string='14.0.0' +expected_version_string='19.1.0' if [[ "$version_string" =~ "$expected_version_string" ]]; then echo "clang-format version '$version_string' matches '$expected_version_string'" else