Unverified Commit 382ceb57 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Enable literal_only_boolean_expressions (#133186)

Blocking issue (https://github.com/dart-lang/linter/issues/453) for this lint has been resolved.
parent 49306139
...@@ -116,7 +116,7 @@ linter: ...@@ -116,7 +116,7 @@ linter:
- library_prefixes - library_prefixes
- library_private_types_in_public_api - library_private_types_in_public_api
# - lines_longer_than_80_chars # not required by flutter style # - lines_longer_than_80_chars # not required by flutter style
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453 - literal_only_boolean_expressions
# - matching_super_parameters # blocked on https://github.com/dart-lang/language/issues/2509 # - matching_super_parameters # blocked on https://github.com/dart-lang/language/issues/2509
- missing_whitespace_between_adjacent_strings - missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list - no_adjacent_strings_in_list
......
...@@ -915,14 +915,11 @@ class _DayPickerState extends State<_DayPicker> { ...@@ -915,14 +915,11 @@ class _DayPickerState extends State<_DayPicker> {
/// ///
List<Widget> _dayHeaders(TextStyle? headerStyle, MaterialLocalizations localizations) { List<Widget> _dayHeaders(TextStyle? headerStyle, MaterialLocalizations localizations) {
final List<Widget> result = <Widget>[]; final List<Widget> result = <Widget>[];
for (int i = localizations.firstDayOfWeekIndex; true; i = (i + 1) % 7) { for (int i = localizations.firstDayOfWeekIndex; result.length < DateTime.daysPerWeek; i = (i + 1) % DateTime.daysPerWeek) {
final String weekday = localizations.narrowWeekdays[i]; final String weekday = localizations.narrowWeekdays[i];
result.add(ExcludeSemantics( result.add(ExcludeSemantics(
child: Center(child: Text(weekday, style: headerStyle)), child: Center(child: Text(weekday, style: headerStyle)),
)); ));
if (i == (localizations.firstDayOfWeekIndex - 1) % 7) {
break;
}
} }
return result; return result;
} }
......
...@@ -2093,14 +2093,11 @@ class _DayHeaders extends StatelessWidget { ...@@ -2093,14 +2093,11 @@ class _DayHeaders extends StatelessWidget {
/// ///
List<Widget> _getDayHeaders(TextStyle headerStyle, MaterialLocalizations localizations) { List<Widget> _getDayHeaders(TextStyle headerStyle, MaterialLocalizations localizations) {
final List<Widget> result = <Widget>[]; final List<Widget> result = <Widget>[];
for (int i = localizations.firstDayOfWeekIndex; true; i = (i + 1) % 7) { for (int i = localizations.firstDayOfWeekIndex; result.length < DateTime.daysPerWeek; i = (i + 1) % DateTime.daysPerWeek) {
final String weekday = localizations.narrowWeekdays[i]; final String weekday = localizations.narrowWeekdays[i];
result.add(ExcludeSemantics( result.add(ExcludeSemantics(
child: Center(child: Text(weekday, style: headerStyle)), child: Center(child: Text(weekday, style: headerStyle)),
)); ));
if (i == (localizations.firstDayOfWeekIndex - 1) % 7) {
break;
}
} }
return result; return result;
} }
...@@ -2512,13 +2509,9 @@ class _MonthItemState extends State<_MonthItem> { ...@@ -2512,13 +2509,9 @@ class _MonthItemState extends State<_MonthItem> {
final double gridHeight = weeks * _monthItemRowHeight + (weeks - 1) * _monthItemSpaceBetweenRows; final double gridHeight = weeks * _monthItemRowHeight + (weeks - 1) * _monthItemSpaceBetweenRows;
final List<Widget> dayItems = <Widget>[]; final List<Widget> dayItems = <Widget>[];
for (int i = 0; true; i += 1) { // 1-based day of month, e.g. 1-31 for January, and 1-29 for February on
// 1-based day of month, e.g. 1-31 for January, and 1-29 for February on // a leap year.
// a leap year. for (int day = 0 - dayOffset + 1; day <= daysInMonth; day += 1) {
final int day = i - dayOffset + 1;
if (day > daysInMonth) {
break;
}
if (day < 1) { if (day < 1) {
dayItems.add(Container()); dayItems.add(Container());
} else { } else {
......
...@@ -1830,7 +1830,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta ...@@ -1830,7 +1830,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
double correction; double correction;
double effectiveExtent; double effectiveExtent;
do { while (true) {
correction = _attemptLayout(mainAxisExtent, crossAxisExtent, offset.pixels); correction = _attemptLayout(mainAxisExtent, crossAxisExtent, offset.pixels);
if (correction != 0.0) { if (correction != 0.0) {
offset.correctBy(correction); offset.correctBy(correction);
...@@ -1847,7 +1847,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta ...@@ -1847,7 +1847,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
break; break;
} }
} }
} while (true); }
switch (axis) { switch (axis) {
case Axis.vertical: case Axis.vertical:
size = constraints.constrainDimensions(crossAxisExtent, effectiveExtent); size = constraints.constrainDimensions(crossAxisExtent, effectiveExtent);
......
...@@ -486,7 +486,7 @@ abstract class FlutterCommand extends Command<void> { ...@@ -486,7 +486,7 @@ abstract class FlutterCommand extends Command<void> {
} }
ddsEnabled = !boolArg('disable-dds'); ddsEnabled = !boolArg('disable-dds');
// TODO(ianh): enable the following code once google3 is migrated away from --disable-dds (and add test to flutter_command_test.dart) // TODO(ianh): enable the following code once google3 is migrated away from --disable-dds (and add test to flutter_command_test.dart)
if (false) { // ignore: dead_code if (false) { // ignore: dead_code, literal_only_boolean_expressions
if (ddsEnabled) { if (ddsEnabled) {
globals.printWarning('${globals.logger.terminal globals.printWarning('${globals.logger.terminal
.warningMark} The "--no-disable-dds" argument is deprecated and redundant, and should be omitted.'); .warningMark} The "--no-disable-dds" argument is deprecated and redundant, and should be omitted.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment