pw_presubmit: Run bazel_lint on the WORKSPACE file

Fix the lint failure this revealed.

Also remove the buildifier targets. They are obsolete because we run
buildifier through the bazel_lint presubmit program.

Change-Id: I32fb1638295bd994d623e04d119a000042aa538c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/106072
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
diff --git a/BUILD.bazel b/BUILD.bazel
index 9d4cb4f..a7ef535 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -12,50 +12,9 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-load(
-    "@com_github_bazelbuild_buildtools//buildifier:def.bzl",
-    "buildifier",
-    "buildifier_test",
-)
-
 licenses(["notice"])
 
 exports_files(
     ["tsconfig.json"],
     visibility = [":__subpackages__"],
 )
-
-# Fix all Bazel relevant files.
-buildifier(
-    name = "buildifier",
-    # Ignore gn and CIPD outputs in formatting.
-    # NOTE: These globs are not Bazel native and are passed directly
-    # through to the buildifier binary.
-    # TODO: Remove these globs when
-    # https://github.com/bazelbuild/buildtools/issues/623 is addressed.
-    exclude_patterns = [
-        "./.environment/**/*",
-        "./.presubmit/**/*",
-        "./.out/**/*",
-    ],
-)
-
-# Test to ensure all Bazel build files are properly formatted.
-buildifier_test(
-    name = "buildifier_test",
-    srcs = glob(
-        [
-            "**/*.bazel",
-            "**/*.bzl",
-            "**/*.oss",
-            "**/*.sky",
-            "**/BUILD",
-        ],
-        # Node modules do not play nice with buildifier. Exclude these
-        # generated Bazel files from format testing.
-        exclude = ["**/node_modules/**/*"],
-    ) + ["WORKSPACE"],
-    diff_command = "diff -u",
-    mode = "diff",
-    verbose = True,
-)
diff --git a/WORKSPACE b/WORKSPACE
index e19ba19..dbcc454 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -98,20 +98,6 @@
     remote = "https://github.com/bazelbuild/stardoc.git",
 )
 
-# Set up Protobuf rules.
-# Required by: pigweed, com_github_bazelbuild_buildtools.
-# Used in modules: //pw_protobuf.
-http_archive(
-    name = "com_google_protobuf",
-    sha256 = "c6003e1d2e7fefa78a3039f19f383b4f3a61e81be8c19356f85b6461998ad3db",
-    strip_prefix = "protobuf-3.17.3",
-    url = "https://github.com/protocolbuffers/protobuf/archive/v3.17.3.tar.gz",
-)
-
-load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
-
-protobuf_deps()
-
 # Set up tools to build custom GRPC rules.
 # Required by: pigweed.
 # Used in modules: //pw_protobuf.
diff --git a/pw_presubmit/py/pw_presubmit/build.py b/pw_presubmit/py/pw_presubmit/build.py
index 9b88828..f7a1f5d 100644
--- a/pw_presubmit/py/pw_presubmit/build.py
+++ b/pw_presubmit/py/pw_presubmit/build.py
@@ -30,6 +30,7 @@
 from pw_presubmit import (
     call,
     Check,
+    FileFilter,
     filter_paths,
     format_code,
     log_run,
@@ -355,7 +356,8 @@
             proc.terminate()
 
 
-@filter_paths(endswith=('.bzl', '.bazel'))
+@filter_paths(file_filter=FileFilter(endswith=('.bzl', '.bazel'),
+                                     name=('WORKSPACE', )))
 def bazel_lint(ctx: PresubmitContext):
     """Runs buildifier with lint on Bazel files.