aspect-build / aspect-workflows-template

Scaffolding for new Aspect workspace
1 stars 1 forks source link

Add 'aspect run format' pre-commit hook. #63

Closed jab closed 1 month ago

jab commented 2 months ago

The README.bazel.md that is currently generated mentions the ability to use pre-commit to format code automatically on git commit.

With these changes, a .pre-commit-config.yaml is now generated that configures an 'aspect run format' hook out-of-the-box when users opt into formatting/linting.


Changes are visible to end-users: yes

Suggested release notes

When generating a new project with linting/formatting enabled, a .pre-commit-config.yaml is now written that configures an aspect run format pre-commit hook.

Test plan

  1. Run aspect init, opting into auto-formatting
  2. Run pre-commit install
  3. git commit any file subject to auto-formatting (e.g. BUILD.bazel)
  4. Observe the aspect-format pre-commit hook run before the commit is accepted:
    ❯ git commit
    aspect-format............................................................Passed