diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 692ade9e8c..5e6c5b3688 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -40,7 +40,7 @@ To upload images to a PR -- simply drag and drop an image while in edit mode and ## Checklist -- [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with `pre-commit run --all-files` (see [here](https://pre-commit.com/#install) instructions to set it up) +- [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./orbit.sh --format` - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works diff --git a/docs/source/refs/contributing.rst b/docs/source/refs/contributing.rst index 040df9d8d8..35a5e2cfa7 100644 --- a/docs/source/refs/contributing.rst +++ b/docs/source/refs/contributing.rst @@ -76,7 +76,7 @@ following command in the terminal: .. code:: bash - pre-commit run --all-files + ./orbit.sh --format Maintaining a changelog ----------------------- diff --git a/docs/source/setup/developer.rst b/docs/source/setup/developer.rst index 948933ffb5..7aedd60585 100644 --- a/docs/source/setup/developer.rst +++ b/docs/source/setup/developer.rst @@ -248,4 +248,4 @@ To run over the entire repository, please execute the following command in the t .. code:: bash - pre-commit run --all-files + ./orbit.sh --format diff --git a/orbit.sh b/orbit.sh index ee40b20e4f..f37574242c 100755 --- a/orbit.sh +++ b/orbit.sh @@ -110,8 +110,6 @@ while [[ $# -gt 0 ]]; do # this does not check dependencies between extensions export -f extract_isaacsim_python export -f install_orbit_extension - # initialize git hooks - pip install pre-commit # source directory find -L "${ORBIT_PATH}/source/extensions" -mindepth 1 -maxdepth 1 -type d -exec bash -c 'install_orbit_extension "{}"' \; # unset local variables @@ -146,8 +144,15 @@ while [[ $# -gt 0 ]]; do ;; # run the formatter over the repository -f|--format) + if ! command -v pre-commit &>/dev/null; then + echo "[INFO] Installing pre-commit..." + pip install pre-commit + fi echo "[INFO] Formatting the repository..." + # always execute inside the Orbit directory + cd "${ORBIT_PATH}" pre-commit run --all-files + cd - shift # past argument # exit neatly break