Allow lints in status file tests and front_end

See comments on https://dart-review.googlesource.com/c/sdk/+/106726

- Add a `should_skip` argument to `_CheckFormat` to suppress warnings in
  files that are opted out of format checking.
- Skip status file lint checks for files under
  "pkg/status_file/test/data" and "pkg/front_end".

Change-Id: I485cf32c5193bbbc7ef2b92bfc401399acda85c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106925
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 520d015..0a39483 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -17,13 +17,15 @@
 
 
 def _CheckFormat(input_api, identification, extension, windows,
-    hasFormatErrors):
+    hasFormatErrors, should_skip = lambda path : False):
   local_root = input_api.change.RepositoryRoot()
   upstream = input_api.change._upstream
   unformatted_files = []
   for git_file in input_api.AffectedTextFiles():
     if git_file.LocalPath().startswith("pkg/front_end/testcases/"):
       continue
+    if should_skip(git_file.LocalPath()):
+      continue
     filename = git_file.AbsoluteLocalPath()
     if filename.endswith(extension) and hasFormatErrors(filename=filename):
       old_version_has_errors = False
@@ -147,8 +149,12 @@
     process.communicate(input=contents)
     return process.returncode != 0
 
+  def should_skip(path):
+      return (path.startswith("pkg/status_file/test/data/")
+              or path.startswith("pkg/front_end/"))
+
   unformatted_files = _CheckFormat(input_api, "status file", ".status",
-      windows, HasFormatErrors)
+      windows, HasFormatErrors, should_skip)
 
   if unformatted_files:
     normalize = os.path.join(local_root, 'pkg', 'status_file', 'bin',