From bb42e9dad348315e75a93f0614915f0d0cdb3c5a Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 25 Jun 2019 17:45:12 +0000 Subject: [PATCH] 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 Commit-Queue: Nate Bosch --- PRESUBMIT.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 520d0159e64..0a3948320b3 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -17,13 +17,15 @@ import tempfile 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 @@ def _CheckStatusFiles(input_api, output_api): 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',