Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake-format pre-commit hooks and linters #771

Merged
merged 43 commits into from Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ea7ac9e
Make all ipynb work locally
Skylion007 Aug 26, 2020
a5bd624
Add path classifiers to .lgtm
Skylion007 Aug 26, 2020
6c61336
Remove unncessary glob
Skylion007 Aug 26, 2020
785c924
Update black and lint repo
Skylion007 Aug 26, 2020
9d6259c
Sort yaml
Skylion007 Aug 26, 2020
8185dd7
Enable flake8-bugbear plugin
Skylion007 Aug 27, 2020
d576a43
Fix a few more flake8-bugbear errors
Skylion007 Aug 27, 2020
5171f8f
Attempt to add pre-commit hooks to .circleci
Skylion007 Aug 27, 2020
45365b4
Add job to .circleci
Skylion007 Aug 27, 2020
2b22e96
Merge branch 'master' of https://github.com/facebookresearch/habitat-…
Skylion007 Aug 27, 2020
e46071f
Add system dependencies for pre-commit
Skylion007 Aug 27, 2020
4fb11df
Skip system hooks
Skylion007 Aug 27, 2020
c0a96bd
fix typo
Skylion007 Aug 27, 2020
5860b6d
Fix .circleci
Skylion007 Aug 27, 2020
4fde8d8
Black notebooks
Skylion007 Aug 27, 2020
73a7718
Remove unused variable and fix clang-format
Skylion007 Aug 27, 2020
bed02e0
Remove another unused variable
Skylion007 Aug 27, 2020
02fc3b6
Fix bugs in AttributeManager
Skylion007 Aug 27, 2020
a88e6d2
Fix set comprehensions
Skylion007 Aug 27, 2020
c61f65c
Merge branch 'master' of https://github.com/facebookresearch/habitat-…
Skylion007 Aug 27, 2020
d3d43cf
Fix EOF
Skylion007 Aug 27, 2020
be1a5fe
revert sim bindings
Skylion007 Aug 27, 2020
ee6635f
Fix true false errors
Skylion007 Aug 27, 2020
f476e4d
Ignore C408
Skylion007 Aug 28, 2020
f2e43de
Ignore C402 and C403
Skylion007 Aug 28, 2020
0b6acb8
Meant C401 and C402
Skylion007 Aug 28, 2020
faaabf9
Merge branch 'master' of https://github.com/facebookresearch/habitat-…
Skylion007 Aug 28, 2020
f90362b
Add cmake-format pre-commit hook and cicheck
Skylion007 Aug 28, 2020
caaa5b6
Commit cmake-format config
Skylion007 Aug 28, 2020
9d35cf9
Fix typos and add missing cmake-formats
Skylion007 Aug 28, 2020
ef760bd
Update cmake-format to ignore Find CMake files
Skylion007 Aug 28, 2020
f11cfbc
Merge branch 'master' of https://github.com/facebookresearch/habitat-…
Skylion007 Aug 28, 2020
de3423b
Adjust cmake-format settings
Skylion007 Aug 31, 2020
bc2f20b
Simplify cmake-format to better match our preferences.
Skylion007 Aug 31, 2020
bf7c3ff
Clean up .pre-commit and cmake-format
Skylion007 Aug 31, 2020
9c309ea
enable autosort cmake-format feature
Skylion007 Aug 31, 2020
1c36627
Attempt to fix pre-commit hooks
Skylion007 Aug 31, 2020
ffa5609
Changed config to mosra's specification
Skylion007 Aug 31, 2020
ca75cf2
always wrap add_library too
Skylion007 Aug 31, 2020
e1d4391
reduce min indent to two
Skylion007 Aug 31, 2020
10edaad
always wrap find_package
Skylion007 Aug 31, 2020
b2d1571
revert find_package
Skylion007 Aug 31, 2020
4d91651
final config tweaks
Skylion007 Aug 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .cmake-format.py
@@ -0,0 +1,8 @@
# flake8: noqa
with section("format"):
dangle_parens = True # Dangle Parens to make diffs cleaner
max_pargs_hwrap = 3 # More aggressive wrapping than defaults


with section("markup"):
enable_markup = False # Don't format comments
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Expand Up @@ -49,6 +49,13 @@ repos:
- flake8-bugbear
- flake8-comprehensions

# - repo: https://github.com/codespell-project/codespell
# rev: v1.17.1
# hooks:
# - id: codespell
# args: ['-w', '-L', 'inout']
# exclude: (^docs/(m.css)|^src/deps|\.ipynb$|\.tag$|\.css$)

- repo: https://github.com/kynan/nbstripout
rev: master
hooks:
Expand Down Expand Up @@ -79,6 +86,12 @@ repos:
files: '.*\.(cpp|h|hpp|cu|cuh)$'
language: system

- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
exclude: (^src/(cmake/Find|deps)|configure\.h\.cmake$)

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v6.4.0
hooks:
Expand Down
31 changes: 21 additions & 10 deletions src/CMakeLists.txt
Expand Up @@ -4,7 +4,9 @@

cmake_minimum_required(VERSION 3.10)

option(BUILD_WITH_CUDA "Build Habitat-Sim with CUDA features enabled -- Requires CUDA" OFF)
option(BUILD_WITH_CUDA
"Build Habitat-Sim with CUDA features enabled -- Requires CUDA" OFF
)

if(BUILD_WITH_CUDA)
project(esp LANGUAGES C CXX CUDA)
Expand All @@ -19,8 +21,8 @@ endif()

find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif()

set(SCENE_DATASETS ${CMAKE_CURRENT_SOURCE_DIR}/../data/scene_datasets)
Expand All @@ -31,23 +33,32 @@ option(BUILD_PYTHON_BINDINGS "Whether to build python bindings" ON)
option(BUILD_DATATOOL "Whether to build datatool utility binary" ON)
option(BUILD_PTEX_SUPPORT "Whether to build ptex mesh support" ON)
option(BUILD_GUI_VIEWERS "Whether to build GUI viewer utility binary" OFF)
option(BUILD_WITH_BULLET "Build Habitat-Sim with Bullet physics enabled -- Requires Bullet" OFF)
option(BUILD_WITH_BULLET
"Build Habitat-Sim with Bullet physics enabled -- Requires Bullet" OFF
)
option(BUILD_TEST "Build test binaries" OFF)
option(USE_SYSTEM_ASSIMP "Use system Assimp instead of a bundled submodule" OFF)
option(USE_SYSTEM_EIGEN "Use system Eigen instead of a bundled submodule" OFF)
option(USE_SYSTEM_GLFW "Use system GLFW instead of a bundled submodule" OFF)
option(USE_SYSTEM_MAGNUM "Use system Magnum instead of a bundled submodule" OFF)
option(USE_SYSTEM_PYBIND11 "Use system Pybind11 instead of a bundled submodule" OFF)
option(USE_SYSTEM_RAPIDJSON "Use system RapidJSON instead of a bundled submodule" OFF)

option(USE_SYSTEM_PYBIND11 "Use system Pybind11 instead of a bundled submodule"
OFF
)
option(USE_SYSTEM_RAPIDJSON
"Use system RapidJSON instead of a bundled submodule" OFF
)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose build, options are: None Debug Release RelWithDebInfo MinSizeRel"
FORCE)
set(CMAKE_BUILD_TYPE
RelWithDebInfo
CACHE
STRING
"Choose build, options are: None Debug Release RelWithDebInfo MinSizeRel"
FORCE
)
endif()
# avoid ld visibility warnings, should be done by CMAKE_CXX_VISIBILITY_PRESET
# but need cmake_policy(SET CMP0063 NEW) also which seems to not work
Expand Down