Perform clang-format check via github action from pre-commit.com

This commit is contained in:
Robert Haschke 2021-03-15 13:49:51 +01:00
parent 0b63c590c5
commit 5de9ce7203
7 changed files with 70 additions and 5 deletions

20
.github/workflows/format.yml vendored Normal file
View File

@ -0,0 +1,20 @@
# This is a format job. Pre-commit has a first-party GitHub action, so we use
# that: https://github.com/pre-commit/action
name: Format
on:
workflow_dispatch:
pull_request:
push:
jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install clang-format-10
run: sudo apt-get install clang-format-10
- uses: pre-commit/action@v2.0.0

1
.gitignore vendored
View File

@ -1,2 +1 @@
*.swp

47
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,47 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: local
hooks:
- id: clang-format
name: clang-format
description: Format files with ClangFormat.
entry: clang-format-10
language: system
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
args: ['-fallback-style=none', '-i']
- repo: local
hooks:
- id: misspelled-moveit
name: misspelled-moveit
description: MoveIt should be spelled exactly as MoveIt
language: pygrep
entry: Moveit|MoveIt!
exclude: .pre-commit-config.yaml|README.md

View File

@ -16,7 +16,6 @@ env:
- UPSTREAM_WORKSPACE=.rosinstall
jobs:
- env: TEST=clang-format
- env: TEST=code-coverage
- compiler: clang
env: DOCKER_IMAGE=moveit/moveit:master-source

View File

@ -277,7 +277,7 @@ void ComputeIK::compute() {
if (value.empty()) { // property undefined
// determine IK link from eef/group
if (!(link = eef_jmg ? robot_model->getLinkModel(eef_jmg->getEndEffectorParentGroup().second) :
jmg->getOnlyOneEndEffectorTip())) {
jmg->getOnlyOneEndEffectorTip())) {
ROS_WARN_STREAM_NAMED("ComputeIK", "Failed to derive IK target link");
return;
}

View File

@ -62,4 +62,4 @@ TEST(Interface, update) {
i.updatePriority(*i.begin(), Prio(6, std::numeric_limits<double>::infinity()));
EXPECT_THAT(i.depths(), ::testing::ElementsAreArray({ 5, 3 })); // larger priority is ignored
}
}

View File

@ -16,4 +16,4 @@
<depend>moveit_core</depend>
<depend>rosparam_shortcuts</depend>
<exec_depend>moveit_resources_panda_moveit_config</exec_depend>
</package>
</package>