aspect-build / rules_lint

Run static analysis tools with Bazel
Apache License 2.0
89 stars 50 forks source link

[Bug]: Does not work unless it is a git repository #436

Open fzakaria opened 7 hours ago

fzakaria commented 7 hours ago

What happened?

I have been using jujutsu https://github.com/martinvonz/jj which is a Git-compatible DVCS. Unfortunately format and format.check only work if it's a git repository.

> bazel run format.check
INFO: Invocation ID: 7569ea60-cd07-46c0-ac9f-cae2e8773c45
INFO: Analyzed target //:format.check (0 packages loaded, 3 targets configured).
INFO: Found 1 target...
Target //tools/format:format.check up-to-date:
  bazel-bin/tools/format/format.check.bash
INFO: Elapsed time: 0.308s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/tools/format/format.check.bash
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

There should be a fallback where it just runs on all the files.

Version

bazel --version bazel 7.4.0

bazel_dep(name = "aspect_rules_lint", version = "1.0.3")

How to reproduce

No response

Any other information?

No response

alexeagle commented 5 hours ago

Interesting, we haven't had a customer using a non-git VCS yet. PRs welcome of course.

As a workaround, you could query jj for the files that are meant to be formatted and pass them as arguments with xargs. The format command only queries git ls-files when there are no arguments of which files to format.

fzakaria commented 2 hours ago

@alexeagle jj is the equivalent to fig a bit internally at Google (in theory); I've been enjoying using it.