From e56e7c3e2142acd6cde50ac4acba6ae41da669cf Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 11:27:01 -0700 Subject: [PATCH] Update pre-commit configuration (backport #28) (#30) * Update pre-commit configuration (#28) * Replaced clang-format executable with hook * added recent formatting changes (cherry picked from commit d48bcbdc3b9f04a6d319088eff1d61d52120e980) # Conflicts: # .devcontainer/nouveau/Dockerfile # .devcontainer/nvidia/Dockerfile # .docker/Dockerfile # .github/workflows/ci.yml # .github/workflows/docker.yml # .pre-commit-config.yaml # .vscode/c_cpp_properties.json # .vscode/settings.json * Resolve backport conflicts --------- Co-authored-by: Evan Palmer --- .devcontainer/nouveau/devcontainer.json | 2 +- .devcontainer/nvidia/devcontainer.json | 3 +-- .docker/Dockerfile | 6 +++--- .pre-commit-config.yaml | 17 +++++++++-------- .vscode/settings.json | 5 ++++- example_pkg/CMakeLists.txt | 6 ++---- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.devcontainer/nouveau/devcontainer.json b/.devcontainer/nouveau/devcontainer.json index aa27d10..7dd4f9f 100644 --- a/.devcontainer/nouveau/devcontainer.json +++ b/.devcontainer/nouveau/devcontainer.json @@ -34,7 +34,7 @@ "esbenp.prettier-vscode", "xaver.clang-format", "charliermarsh.ruff", - "jeff-hykin.better-cpp-syntax" + "ms-vscode.cmake-tools" ] } } diff --git a/.devcontainer/nvidia/devcontainer.json b/.devcontainer/nvidia/devcontainer.json index 067f409..8d8f111 100644 --- a/.devcontainer/nvidia/devcontainer.json +++ b/.devcontainer/nvidia/devcontainer.json @@ -38,8 +38,7 @@ "esbenp.prettier-vscode", "xaver.clang-format", "charliermarsh.ruff", - "ms-python.black-formatter", - "jeff-hykin.better-cpp-syntax" + "ms-vscode.cmake-tools" ] } } diff --git a/.docker/Dockerfile b/.docker/Dockerfile index a27b388..5a3df1d 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -127,6 +127,6 @@ RUN sudo apt-get update \ && sudo rm -rf /var/lib/apt/lists/* # Env vars for the nvidia-container-runtime. -ENV NVIDIA_VISIBLE_DEVICES all -ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute -ENV QT_X11_NO_MITSHM 1 +ENV NVIDIA_VISIBLE_DEVICES=all +ENV NVIDIA_DRIVER_CAPABILITIES=graphics,utility,compute +ENV QT_X11_NO_MITSHM=1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79ad31d..78b2ef4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,15 +10,16 @@ repos: hooks: - id: codespell - - repo: local + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v18.1.8 hooks: - - id: clang-format - name: clang-format - description: Format files with ClangFormat. - entry: clang-format-14 - language: system - files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$ - args: ['-fallback-style=Google', '-i'] + - id: clang-format + types_or: [c++, c] + + - repo: https://github.com/BlankSpruce/gersemi + rev: 0.13.5 + hooks: + - id: gersemi - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 diff --git a/.vscode/settings.json b/.vscode/settings.json index ddfa151..29363cb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -37,6 +37,8 @@ "C_Cpp.codeAnalysis.clangTidy.enabled": true, "C_Cpp.codeAnalysis.clangTidy.codeAction.formatFixes": true, "clang-format.executable": "/usr/bin/clang-format-14", + "xml.format.maxLineWidth": 120, + "xml.format.splitAttributes": "alignWithFirstAttr", "[cpp]": { "editor.rulers": [120], "editor.tabSize": 2, @@ -73,5 +75,6 @@ "**/build": true, "**/install": true, "**/log": true - } + }, + "cmake.ignoreCMakeListsMissing": true } diff --git a/example_pkg/CMakeLists.txt b/example_pkg/CMakeLists.txt index e0393a8..46ab994 100644 --- a/example_pkg/CMakeLists.txt +++ b/example_pkg/CMakeLists.txt @@ -1,12 +1,10 @@ cmake_minimum_required(VERSION 3.8) project(example_pkg) -set(THIS_PACKAGE_INCLUDE_DEPENDS - ament_cmake -) +set(THIS_PACKAGE_INCLUDE_DEPENDS ament_cmake) foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) - find_package(${Dependency} REQUIRED) + find_package(${Dependency} REQUIRED) endforeach() ament_package()