From 62af60f3f62eb24049aa3ef806f44eb522125690 Mon Sep 17 00:00:00 2001 From: Filippo Luca Ferretti Date: Fri, 16 Feb 2024 13:15:17 +0100 Subject: [PATCH] Add instructions for pre-commit hook --- CONTRIBUTING | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING b/CONTRIBUTING index c2243a658..6b595a15d 100644 --- a/CONTRIBUTING +++ b/CONTRIBUTING @@ -8,6 +8,34 @@ We're thrilled that you're considering contributing to JAXsim! Here's a brief gu Make sure your development environment is set up. Follow the installation instructions in the [README](./README.md) to get JAXsim and its dependencies up and running. +To ensure consistency and maintain code quality, we recommend using the pre-commit hook with the following configuration. This will help catch issues before they become a part of the project. + +### Setting Up Pre-commit Hook :fishing_pole_and_fish: + +`pre-commit` is a tool that manages pre-commit hooks for your project. It will run checks on your code before you commit it, ensuring that it meets the project's standards. You should have it already installed if you followed the installation instructions in the [README](./README.md). + +Run the following command to install the hooks: + +```bash +pre-commit install +``` + +### Using Pre-commit Hook 🚦 + +Before making any commits, the pre-commit hook will automatically run. If it finds any issues, it will prevent the commit and provide instructions on how to fix them. + +To get your commit through without fixing the issues, use the `--no-verify` flag: + +```bash +git commit -m "Your commit message" --no-verify +``` + +To manually run the pre-commit hook at any time, use: + +```bash +pre-commit run --all-files +``` + ## Branching Strategy :deciduous_tree: When making changes, create a new branch from main. Use a descriptive name like `feature/your-feature` or `fix/your-fix`. This helps us understand the purpose of the branch. @@ -32,4 +60,4 @@ Expect feedback during the code review process. Address comments and make necess JAXsim is under the [BSD 3-Clause License](./LICENSE). By contributing, you agree to the same license. -Thank you for contributing to JAXsim! Your efforts are appreciated. \ No newline at end of file +Thank you for contributing to JAXsim! Your efforts are appreciated.