Skip to content

Commit

Permalink
python-based parallel style check for py/cpp/jupyter (isl-org#2003)
Browse files Browse the repository at this point in the history
* python-based parallel style check for py/cpp/jupyter

* intentially introduce style error

* remove redundant `pass`

* reorder code

* fix clang-format finder

* require py36, hand-coded version parsing

* fix intentional style errors
  • Loading branch information
yxlao authored and sammo2828 committed Aug 25, 2020
1 parent 6e0d1aa commit 6f53d95
Show file tree
Hide file tree
Showing 7 changed files with 398 additions and 217 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ matrix:
- mkdir build
- cd build
- cmake ..
- pip install -U yapf==0.28.0
- pip install -U yapf==0.28.0 nbformat
- make check-style

# Build headless and docs
Expand Down
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,14 @@ export(EXPORT ${PROJECT_NAME}Targets NAMESPACE ${PROJECT_NAME}::)

# `make check-style` errors if styling is not compliant
add_custom_target(check-style
COMMAND ${CMAKE_COMMAND}
-DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/util/scripts/check-style.cmake
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/util/scripts/check_style.py
)

# `make apply-style` runs clang-format to format all source code
add_custom_target(apply-style
COMMAND ${CMAKE_COMMAND}
-DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/util/scripts/apply-style.cmake
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/util/scripts/check_style.py --do_apply_style
)

function(open3d_aligned_print first second)
Expand Down
3 changes: 2 additions & 1 deletion examples/python/Advanced/multiway_registration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"def load_point_clouds(voxel_size=0.0):\n",
" pcds = []\n",
" for i in range(3):\n",
" pcd = o3d.io.read_point_cloud(\"../../test_data/ICP/cloud_bin_%d.pcd\" % i)\n",
" pcd = o3d.io.read_point_cloud(\"../../test_data/ICP/cloud_bin_%d.pcd\" %\n",
" i)\n",
" pcd_down = pcd.voxel_down_sample(voxel_size=voxel_size)\n",
" pcds.append(pcd_down)\n",
" return pcds"
Expand Down
12 changes: 8 additions & 4 deletions examples/python/Basic/rgbd_image.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@
"outputs": [],
"source": [
"print(\"Read SUN dataset\")\n",
"color_raw = o3d.io.read_image(\"../../test_data/RGBD/other_formats/SUN_color.jpg\")\n",
"depth_raw = o3d.io.read_image(\"../../test_data/RGBD/other_formats/SUN_depth.png\")\n",
"color_raw = o3d.io.read_image(\n",
" \"../../test_data/RGBD/other_formats/SUN_color.jpg\")\n",
"depth_raw = o3d.io.read_image(\n",
" \"../../test_data/RGBD/other_formats/SUN_depth.png\")\n",
"rgbd_image = o3d.geometry.RGBDImage.create_from_sun_format(color_raw, depth_raw)\n",
"print(rgbd_image)"
]
Expand Down Expand Up @@ -260,8 +262,10 @@
"outputs": [],
"source": [
"print(\"Read TUM dataset\")\n",
"color_raw = o3d.io.read_image(\"../../test_data/RGBD/other_formats/TUM_color.png\")\n",
"depth_raw = o3d.io.read_image(\"../../test_data/RGBD/other_formats/TUM_depth.png\")\n",
"color_raw = o3d.io.read_image(\n",
" \"../../test_data/RGBD/other_formats/TUM_color.png\")\n",
"depth_raw = o3d.io.read_image(\n",
" \"../../test_data/RGBD/other_formats/TUM_depth.png\")\n",
"rgbd_image = o3d.geometry.RGBDImage.create_from_tum_format(color_raw, depth_raw)\n",
"print(rgbd_image)"
]
Expand Down
98 changes: 0 additions & 98 deletions util/scripts/apply-style.cmake

This file was deleted.

107 changes: 0 additions & 107 deletions util/scripts/check-style.cmake

This file was deleted.

Loading

0 comments on commit 6f53d95

Please sign in to comment.