Skip to content

Commit 584fd5f

Browse files
authored
Word substitutions (flutter#59484)
* Word substitutions * ++
1 parent 1bb40ae commit 584fd5f

File tree

16 files changed

+73
-71
lines changed

16 files changed

+73
-71
lines changed

dev/bots/analyze.dart

+9-9
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ final RegExp _deprecationPattern4 = RegExp(r'^ *\)$');
145145
/// the regexp just above...)
146146
const String _ignoreDeprecation = ' // ignore: flutter_deprecation_syntax (see analyze.dart)';
147147

148-
/// Some deprecation notices are grand-fathered in for now. They must have an issue listed.
149-
final RegExp _grandfatheredDeprecation = RegExp(r' // ignore: flutter_deprecation_syntax, https://github.com/flutter/flutter/issues/[0-9]+$');
148+
/// Some deprecation notices are exempt for historical reasons. They must have an issue listed.
149+
final RegExp _legacyDeprecation = RegExp(r' // ignore: flutter_deprecation_syntax, https://github.com/flutter/flutter/issues/[0-9]+$');
150150

151151
Future<void> verifyDeprecations(String workingDirectory, { int minimumMatches = 2000 }) async {
152152
final List<String> errors = <String>[];
@@ -157,7 +157,7 @@ Future<void> verifyDeprecations(String workingDirectory, { int minimumMatches =
157157
for (final String line in lines) {
158158
if (line.contains(_findDeprecationPattern) &&
159159
!line.endsWith(_ignoreDeprecation) &&
160-
!line.contains(_grandfatheredDeprecation)) {
160+
!line.contains(_legacyDeprecation)) {
161161
linesWithDeprecations.add(lineNumber);
162162
}
163163
lineNumber += 1;
@@ -691,7 +691,7 @@ class Hash256 {
691691
// If you are adding/changing template images, use the flutter_template_images
692692
// package and a .img.tmpl placeholder instead.
693693
// If you have other binaries to add, please consult Hixie for advice.
694-
final Set<Hash256> _grandfatheredBinaries = <Hash256>{
694+
final Set<Hash256> _legacyBinaries = <Hash256>{
695695
// DEFAULT ICON IMAGES
696696

697697
// packages/flutter_tools/templates/app/android.tmpl/app/src/main/res/mipmap-hdpi/ic_launcher.png
@@ -1046,18 +1046,18 @@ final Set<Hash256> _grandfatheredBinaries = <Hash256>{
10461046
const Hash256(0x63D2ABD0041C3E3B, 0x4B52AD8D382353B5, 0x3C51C6785E76CE56, 0xED9DACAD2D2E31C4),
10471047
};
10481048

1049-
Future<void> verifyNoBinaries(String workingDirectory, { Set<Hash256> grandfatheredBinaries }) async {
1050-
// Please do not add anything to the _grandfatheredBinaries set above.
1049+
Future<void> verifyNoBinaries(String workingDirectory, { Set<Hash256> legacyBinaries }) async {
1050+
// Please do not add anything to the _legacyBinaries set above.
10511051
// We have a policy of not checking in binaries into this repository.
10521052
// If you are adding/changing template images, use the flutter_template_images
10531053
// package and a .img.tmpl placeholder instead.
10541054
// If you have other binaries to add, please consult Hixie for advice.
10551055
assert(
1056-
_grandfatheredBinaries
1056+
_legacyBinaries
10571057
.expand<int>((Hash256 hash) => <int>[hash.a, hash.b, hash.c, hash.d])
10581058
.reduce((int value, int element) => value ^ element) == 0x606B51C908B40BFA // Please do not modify this line.
10591059
);
1060-
grandfatheredBinaries ??= _grandfatheredBinaries;
1060+
legacyBinaries ??= _legacyBinaries;
10611061
if (!Platform.isWindows) { // TODO(ianh): Port this to Windows
10621062
final EvalResult evalResult = await _evalCommand(
10631063
'git', <String>['ls-files', '-z'],
@@ -1087,7 +1087,7 @@ Future<void> verifyNoBinaries(String workingDirectory, { Set<Hash256> grandfathe
10871087
utf8.decode(bytes);
10881088
} on FormatException catch (error) {
10891089
final Digest digest = sha256.convert(bytes);
1090-
if (!grandfatheredBinaries.contains(Hash256.fromDigest(digest)))
1090+
if (!legacyBinaries.contains(Hash256.fromDigest(digest)))
10911091
problems.add('${file.path}:${error.offset}: file is not valid UTF-8');
10921092
}
10931093
}

dev/bots/test.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ int get webShardCount => Platform.environment.containsKey('WEB_SHARD_COUNT')
8282

8383
/// Tests that we don't run on Web for various reasons.
8484
//
85-
// TODO(yjbanov): we're getting rid of this blacklist as part of https://github.com/flutter/flutter/projects/60
86-
const List<String> kWebTestFileBlacklist = <String>[
85+
// TODO(yjbanov): we're getting rid of this as part of https://github.com/flutter/flutter/projects/60
86+
const List<String> kWebTestFileKnownFailures = <String>[
8787
// This test doesn't compile because it depends on code outside the flutter package.
8888
'test/examples/sector_layout_test.dart',
8989
// This test relies on widget tracking capability in the VM.
@@ -699,7 +699,7 @@ Future<void> _runWebUnitTests() async {
699699
)
700700
.whereType<File>()
701701
.map<String>((File file) => path.relative(file.path, from: flutterPackageDirectory.path))
702-
.where((String filePath) => !kWebTestFileBlacklist.contains(filePath))
702+
.where((String filePath) => !kWebTestFileKnownFailures.contains(filePath))
703703
.toList()
704704
// Finally we shuffle the list because we want the average cost per file to be uniformly
705705
// distributed. If the list is not sorted then different shards and batches may have

dev/bots/test/analyze_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void main() {
9595
test('analyze.dart - verifyNoBinaries - positive', () async {
9696
final String result = await capture(() => verifyNoBinaries(
9797
testRootPath,
98-
grandfatheredBinaries: <Hash256>{const Hash256(0x39A050CD69434936, 0, 0, 0)},
98+
legacyBinaries: <Hash256>{const Hash256(0x39A050CD69434936, 0, 0, 0)},
9999
), exitCode: Platform.isWindows ? 0 : 1);
100100
if (!Platform.isWindows) {
101101
// The output starts with the call to git ls-files, the details of which
@@ -116,7 +116,7 @@ void main() {
116116
test('analyze.dart - verifyNoBinaries - negative', () async {
117117
await capture(() => verifyNoBinaries(
118118
testRootPath,
119-
grandfatheredBinaries: <Hash256>{
119+
legacyBinaries: <Hash256>{
120120
const Hash256(0xA8100AE6AA1940D0, 0xB663BB31CD466142, 0xEBBDBD5187131B92, 0xD93818987832EB89), // sha256("\xff")
121121
const Hash256(0x155644D3F13D98BF, 0, 0, 0),
122122
},

dev/devicelab/bin/tasks/technical_debt__cost.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ const double skipCost = 2473.0; // 20 hours: 5 to fix the issue we're ignoring,
1818
const double ignoreForFileCost = 2477.0; // similar thinking as skipCost
1919
const double asDynamicCost = 2011.0; // a few days to refactor the code.
2020
const double deprecationCost = 233.0; // a few hours to remove the old code.
21-
const double grandfatheredDeprecationCost = 9973.0; // a couple of weeks.
21+
const double legacyDeprecationCost = 9973.0; // a couple of weeks.
2222

2323
final RegExp todoPattern = RegExp(r'(?://|#) *TODO');
2424
final RegExp ignorePattern = RegExp(r'// *ignore:');
2525
final RegExp ignoreForFilePattern = RegExp(r'// *ignore_for_file:');
2626
final RegExp asDynamicPattern = RegExp(r'\bas dynamic\b');
2727
final RegExp deprecationPattern = RegExp(r'^ *@[dD]eprecated');
2828
const Pattern globalsPattern = 'globals.';
29-
const String grandfatheredDeprecationPattern = '// ignore: flutter_deprecation_syntax, https';
29+
const String legacyDeprecationPattern = '// ignore: flutter_deprecation_syntax, https';
3030

3131
Future<double> findCostsForFile(File file) async {
3232
if (path.extension(file.path) == '.py')
@@ -48,8 +48,8 @@ Future<double> findCostsForFile(File file) async {
4848
total += asDynamicCost;
4949
if (line.contains(deprecationPattern))
5050
total += deprecationCost;
51-
if (line.contains(grandfatheredDeprecationPattern))
52-
total += grandfatheredDeprecationCost;
51+
if (line.contains(legacyDeprecationPattern))
52+
total += legacyDeprecationCost;
5353
if (isTest && line.contains('skip:'))
5454
total += skipCost;
5555
}

packages/flutter/lib/src/foundation/debug.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ Future<T> debugInstrumentAction<T>(String description, Future<T> action()) {
7272
/// Argument passed to [Timeline] events in order to cause those events to be
7373
/// shown in the developer-centric version of the Observatory Timeline.
7474
///
75+
/// Generally these indicate landmark events such as the build phase or layout.
76+
///
7577
/// See also:
7678
///
7779
/// * [Timeline.startSync], which typically takes this value as its `arguments`
7880
/// argument.
79-
const Map<String, String> timelineWhitelistArguments = <String, String>{
81+
const Map<String, String> timelineArgumentsIndicatingLandmarkEvent = <String, String>{
8082
'mode': 'basic',
8183
};
8284

packages/flutter/lib/src/rendering/binding.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
414414
@override
415415
Future<void> performReassemble() async {
416416
await super.performReassemble();
417-
Timeline.startSync('Dirty Render Tree', arguments: timelineWhitelistArguments);
417+
Timeline.startSync('Dirty Render Tree', arguments: timelineArgumentsIndicatingLandmarkEvent);
418418
try {
419419
renderView.reassemble();
420420
} finally {

packages/flutter/lib/src/rendering/object.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class PaintingContext extends ClipContext {
173173
void paintChild(RenderObject child, Offset offset) {
174174
assert(() {
175175
if (debugProfilePaintsEnabled)
176-
Timeline.startSync('${child.runtimeType}', arguments: timelineWhitelistArguments);
176+
Timeline.startSync('${child.runtimeType}', arguments: timelineArgumentsIndicatingLandmarkEvent);
177177
if (debugOnProfilePaint != null)
178178
debugOnProfilePaint(child);
179179
return true;
@@ -873,7 +873,7 @@ class PipelineOwner {
873873
/// See [RendererBinding] for an example of how this function is used.
874874
void flushLayout() {
875875
if (!kReleaseMode) {
876-
Timeline.startSync('Layout', arguments: timelineWhitelistArguments);
876+
Timeline.startSync('Layout', arguments: timelineArgumentsIndicatingLandmarkEvent);
877877
}
878878
assert(() {
879879
_debugDoingLayout = true;
@@ -965,7 +965,7 @@ class PipelineOwner {
965965
/// See [RendererBinding] for an example of how this function is used.
966966
void flushPaint() {
967967
if (!kReleaseMode) {
968-
Timeline.startSync('Paint', arguments: timelineWhitelistArguments);
968+
Timeline.startSync('Paint', arguments: timelineArgumentsIndicatingLandmarkEvent);
969969
}
970970
assert(() {
971971
_debugDoingPaint = true;

packages/flutter/lib/src/rendering/view.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
226226
///
227227
/// Actually causes the output of the rendering pipeline to appear on screen.
228228
void compositeFrame() {
229-
Timeline.startSync('Compositing', arguments: timelineWhitelistArguments);
229+
Timeline.startSync('Compositing', arguments: timelineArgumentsIndicatingLandmarkEvent);
230230
try {
231231
final ui.SceneBuilder builder = ui.SceneBuilder();
232232
final ui.Scene scene = layer.buildScene(builder);

packages/flutter/lib/src/scheduler/binding.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ mixin SchedulerBinding on BindingBase {
994994
/// statements printed during a frame from those printed between frames (e.g.
995995
/// in response to events or timers).
996996
void handleBeginFrame(Duration rawTimeStamp) {
997-
Timeline.startSync('Frame', arguments: timelineWhitelistArguments);
997+
Timeline.startSync('Frame', arguments: timelineArgumentsIndicatingLandmarkEvent);
998998
_firstRawTimeStampInEpoch ??= rawTimeStamp;
999999
_currentFrameTimeStamp = _adjustForEpoch(rawTimeStamp ?? _lastRawTimeStamp);
10001000
if (rawTimeStamp != null)
@@ -1021,7 +1021,7 @@ mixin SchedulerBinding on BindingBase {
10211021
_hasScheduledFrame = false;
10221022
try {
10231023
// TRANSIENT FRAME CALLBACKS
1024-
Timeline.startSync('Animate', arguments: timelineWhitelistArguments);
1024+
Timeline.startSync('Animate', arguments: timelineArgumentsIndicatingLandmarkEvent);
10251025
_schedulerPhase = SchedulerPhase.transientCallbacks;
10261026
final Map<int, _FrameCallbackEntry> callbacks = _transientCallbacks;
10271027
_transientCallbacks = <int, _FrameCallbackEntry>{};

packages/flutter/lib/src/widgets/framework.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -2603,7 +2603,7 @@ class BuildOwner {
26032603
_debugBuilding = true;
26042604
return true;
26052605
}());
2606-
Timeline.startSync('Build', arguments: timelineWhitelistArguments);
2606+
Timeline.startSync('Build', arguments: timelineArgumentsIndicatingLandmarkEvent);
26072607
try {
26082608
_scheduledFlushDirtyElements = true;
26092609
if (callback != null) {
@@ -2748,7 +2748,7 @@ class BuildOwner {
27482748
/// After the current call stack unwinds, a microtask that notifies listeners
27492749
/// about changes to global keys will run.
27502750
void finalizeTree() {
2751-
Timeline.startSync('Finalize tree', arguments: timelineWhitelistArguments);
2751+
Timeline.startSync('Finalize tree', arguments: timelineArgumentsIndicatingLandmarkEvent);
27522752
try {
27532753
lockState(() {
27542754
_inactiveElements._unmountAll(); // this unregisters the GlobalKeys
@@ -4534,7 +4534,7 @@ abstract class ComponentElement extends Element {
45344534
@override
45354535
void performRebuild() {
45364536
if (!kReleaseMode && debugProfileBuildsEnabled)
4537-
Timeline.startSync('${widget.runtimeType}', arguments: timelineWhitelistArguments);
4537+
Timeline.startSync('${widget.runtimeType}', arguments: timelineArgumentsIndicatingLandmarkEvent);
45384538

45394539
assert(_debugSetAllowIgnoredCallsToMarkNeedsBuild(true));
45404540
Widget built;

packages/flutter_tools/lib/src/android/android_device.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class AndroidDevice extends Device {
270270
workingDirectory: workingDirectory,
271271
allowReentrantFlutter: allowReentrantFlutter,
272272
environment: environment,
273-
whiteListFailures: (int value) => allowHeapCorruptionOnWindows(value, _platform),
273+
allowedFailures: (int value) => allowHeapCorruptionOnWindows(value, _platform),
274274
).stdout.trim();
275275
}
276276

@@ -284,7 +284,7 @@ class AndroidDevice extends Device {
284284
throwOnError: true,
285285
workingDirectory: workingDirectory,
286286
allowReentrantFlutter: allowReentrantFlutter,
287-
whiteListFailures: (int value) => allowHeapCorruptionOnWindows(value, _platform),
287+
allowedFailures: (int value) => allowHeapCorruptionOnWindows(value, _platform),
288288
);
289289
}
290290

@@ -1077,7 +1077,7 @@ class AdbLogReader extends DeviceLogReader {
10771077
// 'W/ActivityManager(pid): '
10781078
static final RegExp _logFormat = RegExp(r'^[VDIWEF]\/.*?\(\s*(\d+)\):\s');
10791079

1080-
static final List<RegExp> _whitelistedTags = <RegExp>[
1080+
static final List<RegExp> _allowedTags = <RegExp>[
10811081
RegExp(r'^[VDIWEF]\/flutter[^:]*:\s+', caseSensitive: false),
10821082
RegExp(r'^[IE]\/DartVM[^:]*:\s+'),
10831083
RegExp(r'^[WEF]\/AndroidRuntime:\s+'),
@@ -1149,7 +1149,7 @@ class AdbLogReader extends DeviceLogReader {
11491149
}
11501150
} else {
11511151
// Filter on approved names and levels.
1152-
acceptLine = _whitelistedTags.any((RegExp re) => re.hasMatch(line));
1152+
acceptLine = _allowedTags.any((RegExp re) => re.hasMatch(line));
11531153
}
11541154

11551155
if (acceptLine) {

packages/flutter_tools/lib/src/base/process.dart

+10-10
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ abstract class ProcessUtils {
198198
/// When [throwOnError] is `true`, if the child process finishes with a non-zero
199199
/// exit code, a [ProcessException] is thrown.
200200
///
201-
/// If [throwOnError] is `true`, and [whiteListFailures] is supplied,
201+
/// If [throwOnError] is `true`, and [allowedFailures] is supplied,
202202
/// a [ProcessException] is only thrown on a non-zero exit code if
203-
/// [whiteListFailures] returns false when passed the exit code.
203+
/// [allowedFailures] returns false when passed the exit code.
204204
///
205205
/// When [workingDirectory] is set, it is the working directory of the child
206206
/// process.
@@ -219,7 +219,7 @@ abstract class ProcessUtils {
219219
Future<RunResult> run(
220220
List<String> cmd, {
221221
bool throwOnError = false,
222-
RunResultChecker whiteListFailures,
222+
RunResultChecker allowedFailures,
223223
String workingDirectory,
224224
bool allowReentrantFlutter = false,
225225
Map<String, String> environment,
@@ -231,7 +231,7 @@ abstract class ProcessUtils {
231231
RunResult runSync(
232232
List<String> cmd, {
233233
bool throwOnError = false,
234-
RunResultChecker whiteListFailures,
234+
RunResultChecker allowedFailures,
235235
bool hideStdout = false,
236236
String workingDirectory,
237237
Map<String, String> environment,
@@ -292,7 +292,7 @@ class _DefaultProcessUtils implements ProcessUtils {
292292
Future<RunResult> run(
293293
List<String> cmd, {
294294
bool throwOnError = false,
295-
RunResultChecker whiteListFailures,
295+
RunResultChecker allowedFailures,
296296
String workingDirectory,
297297
bool allowReentrantFlutter = false,
298298
Map<String, String> environment,
@@ -318,7 +318,7 @@ class _DefaultProcessUtils implements ProcessUtils {
318318
final RunResult runResult = RunResult(results, cmd);
319319
_logger.printTrace(runResult.toString());
320320
if (throwOnError && runResult.exitCode != 0 &&
321-
(whiteListFailures == null || !whiteListFailures(runResult.exitCode))) {
321+
(allowedFailures == null || !allowedFailures(runResult.exitCode))) {
322322
runResult.throwException('Process exited abnormally:\n$runResult');
323323
}
324324
return runResult;
@@ -382,7 +382,7 @@ class _DefaultProcessUtils implements ProcessUtils {
382382
if (exitCode != null) {
383383
_logger.printTrace(runResult.toString());
384384
if (throwOnError && runResult.exitCode != 0 &&
385-
(whiteListFailures == null || !whiteListFailures(exitCode))) {
385+
(allowedFailures == null || !allowedFailures(exitCode))) {
386386
runResult.throwException('Process exited abnormally:\n$runResult');
387387
}
388388
return runResult;
@@ -407,7 +407,7 @@ class _DefaultProcessUtils implements ProcessUtils {
407407
RunResult runSync(
408408
List<String> cmd, {
409409
bool throwOnError = false,
410-
RunResultChecker whiteListFailures,
410+
RunResultChecker allowedFailures,
411411
bool hideStdout = false,
412412
String workingDirectory,
413413
Map<String, String> environment,
@@ -424,8 +424,8 @@ class _DefaultProcessUtils implements ProcessUtils {
424424
_logger.printTrace('Exit code ${runResult.exitCode} from: ${cmd.join(' ')}');
425425

426426
bool failedExitCode = runResult.exitCode != 0;
427-
if (whiteListFailures != null && failedExitCode) {
428-
failedExitCode = !whiteListFailures(runResult.exitCode);
427+
if (allowedFailures != null && failedExitCode) {
428+
failedExitCode = !allowedFailures(runResult.exitCode);
429429
}
430430

431431
if (runResult.stdout.isNotEmpty && !hideStdout) {

packages/flutter_tools/lib/src/ios/simulators.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ class IOSSimulator extends Device {
363363
return false;
364364
}
365365

366-
// Check if the device is part of a blacklisted category.
366+
// Check if the device is part of a blocked category.
367367
// We do not yet support WatchOS or tvOS devices.
368-
final RegExp blacklist = RegExp(r'Apple (TV|Watch)', caseSensitive: false);
369-
if (blacklist.hasMatch(name)) {
368+
final RegExp blocklist = RegExp(r'Apple (TV|Watch)', caseSensitive: false);
369+
if (blocklist.hasMatch(name)) {
370370
_supportMessage = 'Flutter does not support Apple TV or Apple Watch.';
371371
return false;
372372
}

packages/flutter_tools/lib/src/ios/xcodeproj.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ class XcodeProjectInterpreter {
385385
if (projectFilename != null) ...<String>['-project', projectFilename],
386386
],
387387
throwOnError: true,
388-
whiteListFailures: (int c) => c == missingProjectExitCode,
388+
allowedFailures: (int c) => c == missingProjectExitCode,
389389
workingDirectory: projectPath,
390390
);
391391
if (result.exitCode == missingProjectExitCode) {

0 commit comments

Comments
 (0)