turn on curly_braces_in_flow_control_structures for develop-facing code (#105113)

This commit is contained in:
Pierre-Louis
2022-06-02 09:25:40 +00:00
committed by GitHub
parent 3c6719baf5
commit 15aa3bfda3
9 changed files with 16 additions and 7 deletions

View File

@@ -98,7 +98,7 @@ linter:
# - conditional_uri_does_not_exist # not yet tested
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
# - curly_braces_in_flow_control_structures # not required by flutter style
# - curly_braces_in_flow_control_structures # not required by flutter style, but developer-facing code should have this on
- depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)

View File

@@ -4,5 +4,7 @@ include: ../../analysis_options.yaml
linter:
rules:
# Developer-facing code
curly_braces_in_flow_control_structures: true
# Samples want to print things pretty often.
avoid_print: false

View File

@@ -5,5 +5,6 @@ include: ../analysis_options.yaml
linter:
rules:
- curly_braces_in_flow_control_structures # Developer-facing code
- public_member_api_docs # see https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#documentation-dartdocs-javadocs-etc
- no_runtimeType_toString # use objectRuntimeType from package:foundation

View File

@@ -212,8 +212,9 @@ class InkSparkle extends InteractiveInkFeature {
}
void _handleStatusChanged(AnimationStatus status) {
if (status == AnimationStatus.completed)
if (status == AnimationStatus.completed) {
dispose();
}
}
static const Duration _animationDuration = Duration(milliseconds: 617);

View File

@@ -561,8 +561,9 @@ class _RenderInkFeatures extends RenderProxyBox implements MaterialInkController
@visibleForTesting
List<InkFeature>? get debugInkFeatures {
if (kDebugMode)
if (kDebugMode) {
return _inkFeatures;
}
return null;
}
List<InkFeature>? _inkFeatures;

View File

@@ -56,8 +56,9 @@ class SelectionArea extends StatefulWidget {
class _SelectionAreaState extends State<SelectionArea> {
FocusNode get _effectiveFocusNode {
if (widget.focusNode != null)
if (widget.focusNode != null) {
return widget.focusNode!;
}
_internalNode ??= FocusNode();
return _internalNode!;
}

View File

@@ -3054,10 +3054,11 @@ class _CompositeRenderEditablePainter extends RenderEditablePainter {
final Iterator<RenderEditablePainter> oldPainters = oldDelegate.painters.iterator;
final Iterator<RenderEditablePainter> newPainters = painters.iterator;
while (oldPainters.moveNext() && newPainters.moveNext())
while (oldPainters.moveNext() && newPainters.moveNext()) {
if (newPainters.current.shouldRepaint(oldPainters.current)) {
return true;
}
}
return false;
}

View File

@@ -408,10 +408,11 @@ class MouseTracker extends ChangeNotifier {
// hit-test order.
final PointerExitEvent baseExitEvent = PointerExitEvent.fromMouseEvent(latestEvent);
lastAnnotations.forEach((MouseTrackerAnnotation annotation, Matrix4 transform) {
if (!nextAnnotations.containsKey(annotation))
if (!nextAnnotations.containsKey(annotation)) {
if (annotation.validForMouseTracker && annotation.onExit != null) {
annotation.onExit!(baseExitEvent.transformed(lastAnnotations[annotation]));
}
}
});
// Send enter events to annotations that are not in last but in next, in

View File

@@ -1292,8 +1292,9 @@ class RenderSelectAll extends RenderProxyBox
),
);
set value(SelectionGeometry other) {
if (other == _value)
if (other == _value) {
return;
}
_value = other;
for (final VoidCallback callback in listeners) {
callback();