Unverified Commit 9eb78106 authored by Andrej Orsula's avatar Andrej Orsula Committed by GitHub

Separates the installation of pre-commit to -f|--format case in orbit.sh (#28)

* Separate install of `pre-commit` to `-f|--format` case
* Always execute `pre-commit` inside the Orbit directory
* Instruct contributors to run `pre-commit` with `./orbit.sh --format`

---------
Signed-off-by: 's avatarAndrej Orsula <orsula.andrej@gmail.com>
parent 0256022e
......@@ -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
......
......@@ -76,7 +76,7 @@ following command in the terminal:
.. code:: bash
pre-commit run --all-files
./orbit.sh --format
Maintaining a changelog
-----------------------
......
......@@ -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
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment