mirror of
https://github.com/dart-lang/sdk
synced 2024-07-21 10:25:52 +00:00
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>
This commit is contained in:
parent
1f992408c8
commit
bb42e9dad3
10
PRESUBMIT.py
10
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',
|
||||
|
|
Loading…
Reference in a new issue