Make presubmit on Dart files check for default value separator.
This should prevent new code using old syntax. Change-Id: I0620369a34b3838fb4555f5264c93bccf92acc42 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256213 Reviewed-by: Alexander Thomas <athom@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com>
This commit is contained in:
committed by
Commit Bot
parent
bab5cfbe74
commit
5179f5ae94
+7
-2
@@ -125,6 +125,10 @@ def _CheckDartFormat(input_api, output_api):
|
||||
print('WARNING: dart not found: %s' % (dart))
|
||||
return []
|
||||
|
||||
dartFixes = [
|
||||
'--fix-named-default-separator',
|
||||
]
|
||||
|
||||
def HasFormatErrors(filename: str = None, contents: str = None):
|
||||
# Don't look for formatting errors in multitests. Since those are very
|
||||
# sensitive to whitespace, many cannot be reformatted without breaking
|
||||
@@ -138,6 +142,7 @@ def _CheckDartFormat(input_api, output_api):
|
||||
args = [
|
||||
dart,
|
||||
'format',
|
||||
] + dartFixes + [
|
||||
'--set-exit-if-changed',
|
||||
'--output=none',
|
||||
'--summary=none',
|
||||
@@ -181,8 +186,8 @@ def _CheckDartFormat(input_api, output_api):
|
||||
output_api.PresubmitError(
|
||||
'File output does not match dart format.\n'
|
||||
'Fix these issues with:\n'
|
||||
'%s format %s%s' %
|
||||
(dart, lineSep, lineSep.join(unformatted_files)))
|
||||
'%s format %s%s%s' % (dart, ' '.join(dartFixes), lineSep,
|
||||
lineSep.join(unformatted_files)))
|
||||
]
|
||||
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user