Pre-commit steps are a crucial part of the development process, designed to ensure consistency, quality, and integrity of the source code before being committed to the repository. They bring significant benefits to developers and the project as a whole.
Pre-commit hooks help maintain a consistent code style throughout the project. This makes the code more readable for other developers and aids in long-term maintenance.
Running automated tests, linting, and other checks before committing allows for early identification of issues, reducing the likelihood of errors in the code and improving overall software quality.
Enforcing standards for commit messages ensures clear and consistent documentation of the change history, making code review and collaboration among developers more straightforward.
Before committing your changes to the repository, follow the steps below:
-
Activate the virtual environment in the 'backend' directory (when in the root directory):
source backend/.venv/bin/activate
-
Ensure you are in the root directory of the project.
-
Execute the following command to ensure that pre-commit hooks are applied:
pre-commit run --all-files
This will automatically check and fix identified issues in modified files.
-
After successful execution, you can proceed to commit your changes as usual.
By following these instructions, you ensure a smoother workflow and contribute to the overall code quality in the project.