bazelbuild / bazel-central-registry

The central registry of Bazel modules for the Bzlmod external dependency system.
https://registry.bazel.build
Apache License 2.0
233 stars 254 forks source link

Add pre-commit workflow with ruff format #2327

Closed lalten closed 4 days ago

lalten commented 5 days ago

Step 2 of https://github.com/bazelbuild/bazel-central-registry/discussions/2317

Adds a GitHub Actions workflow that runs on each PR as well as on main. Note that depending on repo settings an admin may have to configure this to become "required".

Uses https://github.com/pre-commit/action to run pre-commit.

pre-commit is configured to run the official ruff-format hook I will add the lint hook in a follow-up PR as the lint is still failing.

Added a ruff config file as well to configure the line length to the same number the current formatting was done with.

The workflow already ran on this PR :) https://github.com/bazelbuild/bazel-central-registry/actions/runs/9717570688/job/26823514964?pr=2327#step:4:67

lalten commented 5 days ago

A more Bazel-y alternative would of course be integrating rules_lint (https://github.com/aspect-build/rules_lint/blob/v1.0.0-rc4/docs/ruff.md). I haven't used this myself yet. Guessing the folks over at Aspect would be the fastest to integrate their ruff aspect here @alexeagle ?