 diff --git a/buildifier/buildifier.bzl b/buildifier/buildifier.bzl
-index 42445e7..69f3341 100644
+index 42445e7..0957f94 100644
 --- a/buildifier/buildifier.bzl
 +++ b/buildifier/buildifier.bzl
-@@ -34,8 +34,24 @@ def buildifier(**kwargs):
+@@ -34,8 +34,25 @@ def buildifier(**kwargs):
  def _buildifier_test_impl(ctx):
      return [buildifier_impl_factory(ctx, test_rule = True)]
  

+
+def buildifier_test(**kwargs):
+    """
+    Wrapper for the _buildifier_test rule. Adds tags to disable sandboxing.
+
+    Args:
+      **kwargs: all parameters for _buildifier_test
+    """
+    if kwargs.get("no-sandbox", False):
+        tags = kwargs.get("tags", [])
+        # Note: the "external" tag is a workaround for bazelbuild#15516.
+        for t in ["no-sandbox", "no-cache", "external"]:
+            if t not in tags:

         "mode": attr.string(
             default = "fix" if not test_rule else "diff",
             doc = "Formatting mode",
@@ -80,7 +84,6 @@ def buildifier_attr_factory(test_rule = False):
     if test_rule:
         attrs.update({
             "srcs": attr.label_list(
-                allow_empty = False,
                 allow_files = [
                     ".bazel",
                     ".bzl",
@@ -91,12 +94,13 @@ def buildifier_attr_factory(test_rule = False):
                 ],
                 doc = "A list of labels representing the starlark files to include in the test",
             ),
