PennyLaneAI / catalyst

A JIT compiler for hybrid quantum programs in PennyLane
https://docs.pennylane.ai/projects/catalyst
Apache License 2.0
130 stars 29 forks source link

Adding precommit hook #855

Open albi3ro opened 3 months ago

albi3ro commented 3 months ago

Context:

Precommit hooks make it easier to follow black, pylint, and isort checks as they are run whenever a developer tries to commit changes. This eliminates the back-and-forth with the CI failing because of an accidental extra blank space or missed docstrings. Saves developer time, since they can fix the issue immediately, and saves CI time, since we won't have to have "I forgot black" commits to the PR.

Description of the Change:

Adds a .pre-commit-config.yaml similar to the one in pennylane. At this current point, it only runs checks on the frontend, but I'd be happy to extend it to other parts of the code base too.

pre-commit hooks are opt in, with the developer needing to have precommit installed and run pre-commit install on the repository. They can also be bypassed by including --no-verify when trying to commit.

Benefits:

Fewer failing CI runs due to formatting issues.

Possible Drawbacks:

Related GitHub Issues:

github-actions[bot] commented 3 months ago

Hello. You may have forgotten to update the changelog! Please edit doc/changelog.md on your branch with:

dime10 commented 2 months ago

@albi3ro any updates on this?