Add missing trailing commas (#28673)

* add trailing commas on list/map/parameters

* add trailing commas on Invocation with nb of arg>1

* add commas for widget containing widgets

* add trailing commas if instantiation contains trailing comma

* revert bad change
This commit is contained in:
Alexandre Ardhuin
2019-03-01 08:17:55 +01:00
committed by GitHub
parent 046f960ae2
commit 387f885481
626 changed files with 5183 additions and 5183 deletions

View File

@@ -311,7 +311,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
void dispatchEvent(
PointerEvent event,
HitTestResult hitTestResult, {
TestBindingEventSource source = TestBindingEventSource.device
TestBindingEventSource source = TestBindingEventSource.device,
}) {
assert(source == TestBindingEventSource.test);
super.dispatchEvent(event, hitTestResult);
@@ -374,7 +374,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
'Test starting...',
style: _messageStyle,
textDirection: TextDirection.ltr,
)
),
);
static const Widget _postTestMessage = Center(
@@ -382,7 +382,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
'Test finished.',
style: _messageStyle,
textDirection: TextDirection.ltr,
)
),
);
/// Whether to include the output of debugDumpApp() when reporting
@@ -465,7 +465,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
FlutterError.dumpErrorToConsole(details, forceReport: true);
_pendingExceptionDetails = FlutterErrorDetails(
exception: 'Multiple exceptions ($_exceptionCount) were detected during the running of the current test, and at least one was unexpected.',
library: 'Flutter test framework'
library: 'Flutter test framework',
);
} else {
reportExceptionNoticed(details); // mostly this is just a hook for the LiveTestWidgetsFlutterBinding
@@ -487,7 +487,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
exception: exception,
stack: _unmangle(stack),
context: 'running a test (but after the test had completed)',
library: 'Flutter test framework'
library: 'Flutter test framework',
), forceReport: true);
return;
}
@@ -544,7 +544,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
}
if (description.isNotEmpty)
information.writeln('The test description was:\n$description');
}
},
));
assert(_parentZone != null);
assert(_pendingExceptionDetails != null, 'A test overrode FlutterError.onError but either failed to return it to its original state, or had unexpected additional errors that it could not handle. Typically, this is caused by using expect() before restoring FlutterError.onError.');
@@ -1193,7 +1193,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
void dispatchEvent(
PointerEvent event,
HitTestResult hitTestResult, {
TestBindingEventSource source = TestBindingEventSource.device
TestBindingEventSource source = TestBindingEventSource.device,
}) {
switch (source) {
case TestBindingEventSource.test:
@@ -1361,7 +1361,7 @@ class TestViewConfiguration extends ViewConfiguration {
final Matrix4 matrix = Matrix4.compose(
Vector3(shiftX, shiftY, 0.0), // translation
Quaternion.identity(), // rotation
Vector3(scale, scale, 1.0) // scale
Vector3(scale, scale, 1.0), // scale
);
return matrix;
}
@@ -1391,7 +1391,7 @@ const int _kPointerDecay = -2;
class _LiveTestPointerRecord {
_LiveTestPointerRecord(
this.pointer,
this.position
this.position,
) : color = HSVColor.fromAHSV(0.8, (35.0 * pointer) % 360.0, 1.0, 1.0).toColor(),
decay = 1;
final int pointer;

View File

@@ -308,7 +308,7 @@ abstract class Finder {
Iterable<Element> get allCandidates {
return collectAllElementsFrom(
WidgetsBinding.instance.renderViewElement,
skipOffstage: skipOffstage
skipOffstage: skipOffstage,
);
}

View File

@@ -607,7 +607,7 @@ class _FindsWidgetMatcher extends Matcher {
dynamic item,
Description mismatchDescription,
Map<dynamic, dynamic> matchState,
bool verbose
bool verbose,
) {
final Finder finder = matchState[Finder];
final int count = finder.evaluate().length;
@@ -755,7 +755,7 @@ class _EqualsIgnoringHashCodes extends Matcher {
dynamic item,
Description mismatchDescription,
Map<dynamic, dynamic> matchState,
bool verbose
bool verbose,
) {
if (matchState.containsKey(_mismatchedValueKey)) {
final String actualValue = matchState[_mismatchedValueKey];
@@ -888,7 +888,7 @@ class _HasGoodToStringDeep extends Matcher {
dynamic item,
Description mismatchDescription,
Map<dynamic, dynamic> matchState,
bool verbose
bool verbose,
) {
if (matchState.containsKey(_toStringDeepErrorDescriptionKey)) {
return mismatchDescription.add(
@@ -1216,7 +1216,7 @@ abstract class _FailWithDescriptionMatcher extends Matcher {
dynamic item,
Description mismatchDescription,
Map<dynamic, dynamic> matchState,
bool verbose
bool verbose,
) {
return mismatchDescription.add(matchState['failure']);
}
@@ -1505,7 +1505,7 @@ class _CoversSameAreaAs extends Matcher {
for (int j = 0; j < sampleSize; j += 1) {
final Offset offset = Offset(
i * (areaToCompare.width / sampleSize),
j * (areaToCompare.height / sampleSize)
j * (areaToCompare.height / sampleSize),
);
if (!_samplePoint(matchState, actualPath, offset))
@@ -1543,7 +1543,7 @@ class _CoversSameAreaAs extends Matcher {
dynamic item,
Description mismatchDescription,
Map<dynamic, dynamic> matchState,
bool verbose
bool verbose,
) {
return mismatchDescription.add(matchState['failure']);
}
@@ -1855,7 +1855,7 @@ class _MatchesSemanticsData extends Matcher {
dynamic item,
Description mismatchDescription,
Map<dynamic, dynamic> matchState,
bool verbose
bool verbose,
) {
return mismatchDescription.add(matchState['failure']);
}

View File

@@ -61,7 +61,7 @@ class TestAsyncUtils {
guardSync();
final Zone zone = Zone.current.fork(
zoneValues: <dynamic, dynamic>{
_scopeStack: true // so we can recognize this as our own zone
_scopeStack: true, // so we can recognize this as our own zone
}
);
final _AsyncScope scope = _AsyncScope(StackTrace.current, zone);
@@ -111,7 +111,7 @@ class TestAsyncUtils {
resultValue = value;
return completionHandler(null, null);
},
onError: completionHandler
onError: completionHandler,
);
}

View File

@@ -70,7 +70,7 @@ void testWidgets(
String description,
WidgetTesterCallback callback, {
bool skip = false,
test_package.Timeout timeout
test_package.Timeout timeout,
}) {
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
final WidgetTester tester = WidgetTester._(binding);
@@ -87,7 +87,7 @@ void testWidgets(
);
},
skip: skip,
timeout: timeout
timeout: timeout,
);
}

View File

@@ -163,7 +163,7 @@ void main() {
style: TextStyle(fontSize: 14.0, color: Colors.yellowAccent),
),
),
)
),
],
)
));
@@ -349,10 +349,10 @@ void main() {
child: GestureDetector(
onTap: () {},
child: const SizedBox(width: 4.0, height: 4.0),
)
)
),
),
),
)
),
)
));

View File

@@ -214,7 +214,7 @@ void main() {
class WidgetControllerSpy extends WidgetController {
WidgetControllerSpy(
TestWidgetsFlutterBinding binding
TestWidgetsFlutterBinding binding,
) : super(binding) {
_binding = binding;
}
@@ -250,7 +250,7 @@ class WidgetControllerSpy extends WidgetController {
pointer: pointer ?? _getNextPointer(),
kind: kind,
dispatcher: sendEventToBinding,
hitTester: hitTestOnBinding
hitTester: hitTestOnBinding,
);
}
}
@@ -260,7 +260,7 @@ class TestGestureSpy extends TestGesture {
int pointer,
PointerDeviceKind kind,
EventDispatcher dispatcher,
HitTester hitTester
HitTester hitTester,
}) : super(
pointer: pointer,
kind: kind,

View File

@@ -21,7 +21,7 @@ void main() {
TextSpan(text: 't', children: <TextSpan>[
TextSpan(text: 'e'),
TextSpan(text: 'st'),
]
],
),
)));
@@ -68,7 +68,7 @@ void main() {
),
Container(
child: const Text('2'),
)
),
],
)),
);

View File

@@ -225,7 +225,7 @@ void main() {
Path(),
coversSameAreaAs(
Path(),
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0)
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
),
);
});
@@ -237,7 +237,7 @@ void main() {
Path(),
isNot(coversSameAreaAs(
rectPath,
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0)
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
)),
);
});
@@ -250,7 +250,7 @@ void main() {
Path(),
coversSameAreaAs(
rectPath,
areaToCompare: Rect.fromLTRB(0.0, 0.0, 4.0, 4.0)
areaToCompare: Rect.fromLTRB(0.0, 0.0, 4.0, 4.0),
),
);
});
@@ -268,7 +268,7 @@ void main() {
linePath,
coversSameAreaAs(
rectPath,
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0)
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
),
);
});
@@ -286,7 +286,7 @@ void main() {
linePath,
isNot(coversSameAreaAs(
rectPath,
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0)
areaToCompare: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
)),
);
});
@@ -426,7 +426,7 @@ void main() {
onLongPressHint: 'fill',
customActions: <CustomSemanticsAction>[
const CustomSemanticsAction(label: 'foo'),
const CustomSemanticsAction(label: 'bar')
const CustomSemanticsAction(label: 'bar'),
],
),
);
@@ -447,7 +447,7 @@ void main() {
onLongPressHint: 'fill',
customActions: <CustomSemanticsAction>[
const CustomSemanticsAction(label: 'foo'),
const CustomSemanticsAction(label: 'barz')
const CustomSemanticsAction(label: 'barz'),
],
)),
);
@@ -468,7 +468,7 @@ void main() {
onLongPressHint: 'fills',
customActions: <CustomSemanticsAction>[
const CustomSemanticsAction(label: 'foo'),
const CustomSemanticsAction(label: 'bar')
const CustomSemanticsAction(label: 'bar'),
],
)),
);

View File

@@ -223,7 +223,7 @@ void main() {
try {
expect(find.descendant(
of: find.widgetWithText(Column, 'foo'),
matching: find.text('bar')
matching: find.text('bar'),
), findsOneWidget);
} catch (e) {
failure = e;
@@ -421,7 +421,7 @@ void main() {
testWidgets('hasRunningAnimations control test', (WidgetTester tester) async {
final AnimationController controller = AnimationController(
duration: const Duration(seconds: 1),
vsync: const TestVSync()
vsync: const TestVSync(),
);
expect(tester.hasRunningAnimations, isFalse);
controller.forward();
@@ -437,7 +437,7 @@ void main() {
testWidgets('pumpAndSettle control test', (WidgetTester tester) async {
final AnimationController controller = AnimationController(
duration: const Duration(minutes: 525600),
vsync: const TestVSync()
vsync: const TestVSync(),
);
expect(await tester.pumpAndSettle(), 1);
controller.forward();
@@ -574,7 +574,7 @@ void main() {
body: Container(
child: OutlineButton(
onPressed: () {},
child: const Text('hello')
child: const Text('hello'),
),
),
),
@@ -605,7 +605,7 @@ void main() {
child: Container(),
),
),
)
),
),
),
);

View File

@@ -20,7 +20,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, double fakeValue) {
binding.window.devicePixelRatioTestValue = fakeValue;
}
},
);
});
@@ -34,7 +34,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, Size fakeValue) {
binding.window.physicalSizeTestValue = fakeValue;
}
},
);
});
@@ -48,7 +48,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, WindowPadding fakeValue) {
binding.window.viewInsetsTestValue = fakeValue;
}
},
);
});
@@ -62,7 +62,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, WindowPadding fakeValue) {
binding.window.paddingTestValue = fakeValue;
}
},
);
});
@@ -76,7 +76,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, Locale fakeValue) {
binding.window.localeTestValue = fakeValue;
}
},
);
});
@@ -90,7 +90,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, List<Locale> fakeValue) {
binding.window.localesTestValue = fakeValue;
}
},
);
});
@@ -104,7 +104,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, double fakeValue) {
binding.window.textScaleFactorTestValue = fakeValue;
}
},
);
});
@@ -118,7 +118,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, bool fakeValue) {
binding.window.alwaysUse24HourFormatTestValue = fakeValue;
}
},
);
});
@@ -132,7 +132,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, String fakeValue) {
binding.window.defaultRouteNameTestValue = fakeValue;
}
},
);
});
@@ -146,7 +146,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, AccessibilityFeatures fakeValue) {
binding.window.accessibilityFeaturesTestValue = fakeValue;
}
},
);
});
@@ -160,7 +160,7 @@ void main() {
},
propertyFaker: (TestWidgetsFlutterBinding binding, Brightness fakeValue) {
binding.window.platformBrightnessTestValue = fakeValue;
}
},
);
});