keith / buildifier-prebuilt

A bazel toolchain for using prebuilt binaries for buildifier and buildozer
MIT License
35 stars 13 forks source link

buildifier test passes on failing build files #88

Open peakschris opened 3 months ago

peakschris commented 3 months ago

Maybe I don't understand how to run this, but my naive experiements suggest some issue:

git clone cd examples/simple edit BUILD, mess up formatting bazel run //:buildifier.check shows diffs with corrections bazel test //:buildifier.test reports PASSED

The build file is:

load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")

buildifier(
    name = "buildifier.check",
    exclude_patterns = [
        "./.git/*"],
    lint_mode = "warn",
    lint_warnings = [
        "-cc-native",
    ],
    mode = "diff",
)

buildifier_test(
    name = "buildifier.test",
    srcs = ["BUILD"],
    lint_mode = "warn",
)

sh_binary(
    name = "hello_world",
    srcs = ["hello_world.sh"],
)

sh_test(
    name = "hello_world_test",
    srcs = ["hello_world_test.sh"],
    data = [
        ":hello_world",
    ],
    deps = [
        "@bazel_tools//tools/bash/runfiles",
    ],
)

Thanks!

keith commented 3 months ago

hrm does sound like a bug, want to try and submit a PR with a fix? I think it's probably either https://github.com/keith/buildifier-prebuilt/blob/main/runner.bash.template for macOS / linux or https://github.com/keith/buildifier-prebuilt/blob/main/runner.bat.template for windows that has the issue