Skip to content

Commit

Permalink
Update pre-commit configuration (#28)
Browse files Browse the repository at this point in the history
* Replaced clang-format executable with hook

* added recent formatting changes
  • Loading branch information
evan-palmer committed Aug 15, 2024
1 parent 474bf8c commit d48bcbd
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/nouveau/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/robotic-decision-making-lab/ros2-template:jazzy-desktop
FROM ghcr.io/robotic-decision-making-lab/ros2-template:rolling-desktop

# Install ROS dependencies
# This is done in a previous stage, but we include it again here in case anyone wants to
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/nouveau/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"esbenp.prettier-vscode",
"xaver.clang-format",
"charliermarsh.ruff",
"jeff-hykin.better-cpp-syntax"
"ms-vscode.cmake-tools"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/nvidia/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/robotic-decision-making-lab/ros2-template:jazzy-desktop-nvidia
FROM ghcr.io/robotic-decision-making-lab/ros2-template:rolling-desktop-nvidia

# Install ROS dependencies
# This is done in a previous stage, but we include it again here in case anyone wants to
Expand Down
3 changes: 1 addition & 2 deletions .devcontainer/nvidia/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}
Expand Down
11 changes: 6 additions & 5 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG ROS_DISTRO=jazzy
ARG ROS_DISTRO=rolling
FROM ros:$ROS_DISTRO-ros-base as ci

Check warning on line 2 in .docker/Dockerfile

View workflow job for this annotation

GitHub Actions / robot (rolling)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

ENV DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -62,7 +62,8 @@ COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME
ENV VIRTUAL_ENV=$USER_WORKSPACE/.venv/$PROJECT_NAME
RUN python3 -m venv --system-site-packages $VIRTUAL_ENV \
&& echo "source ${VIRTUAL_ENV}/bin/activate" >> /home/$USERNAME/.bashrc \
&& touch .venv/COLCON_IGNORE
&& touch .venv/COLCON_IGNORE \
&& echo "\n# Ensure colcon is run in the venv\nalias colcon='python3 -m colcon'" >> /home/$USERNAME/.bashrc
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# Uncomment to download and install external repos used by the project
Expand Down Expand Up @@ -115,6 +116,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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
fail-fast: false
matrix:
env:
- IMAGE: jazzy-ci
ROS_DISTRO: jazzy
- IMAGE: rolling-ci
ROS_DISTRO: rolling
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [jazzy]
ROS_DISTRO: [rolling]
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [jazzy]
ROS_DISTRO: [rolling]
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [jazzy]
ROS_DISTRO: [rolling]
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [jazzy]
ROS_DISTRO: [rolling]
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down
17 changes: 9 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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-18
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
Expand Down
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/opt/ros/jazzy/include/**",
"/opt/ros/rolling/include/**",
"/usr/include/gz/**"
],
"defines": [],
Expand Down
13 changes: 8 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,22 @@
"autoDocstring.startOnNewLine": false,
"autoDocstring.docstringFormat": "google-notypes",
"python.autoComplete.extraPaths": [
"/opt/ros/jazzy/lib/python3.12/site-packages/",
"/opt/ros/jazzy/local/lib/python3.12/dist-packages/",
"/opt/ros/rolling/lib/python3.12/site-packages/",
"/opt/ros/rolling/local/lib/python3.12/dist-packages/",
"${workspaceFolder}/install/"
],
"python.analysis.extraPaths": [
"/opt/ros/jazzy/lib/python3.12/site-packages/",
"/opt/ros/jazzy/local/lib/python3.12/dist-packages/",
"/opt/ros/rolling/lib/python3.12/site-packages/",
"/opt/ros/rolling/local/lib/python3.12/dist-packages/",
"${workspaceFolder}/install/"
],
"C_Cpp.default.intelliSenseMode": "linux-gcc-x86",
"C_Cpp.clang_format_fallbackStyle": "Google",
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
"C_Cpp.codeAnalysis.clangTidy.codeAction.formatFixes": true,
"clang-format.executable": "/usr/bin/clang-format-18",
"xml.format.maxLineWidth": 120,
"xml.format.splitAttributes": "alignWithFirstAttr",
"[cpp]": {
"editor.rulers": [120],
"editor.tabSize": 2,
Expand Down Expand Up @@ -73,5 +75,6 @@
"**/build": true,
"**/install": true,
"**/log": true
}
},
"cmake.ignoreCMakeListsMissing": true
}
6 changes: 2 additions & 4 deletions example_pkg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit d48bcbd

Please sign in to comment.