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:
- library_prefixes
- library_private_types_in_public_api
# - 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
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
......
......@@ -915,14 +915,11 @@ class _DayPickerState extends State<_DayPicker> {
///
List<Widget> _dayHeaders(TextStyle? headerStyle, MaterialLocalizations localizations) {
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];
result.add(ExcludeSemantics(
child: Center(child: Text(weekday, style: headerStyle)),
));
if (i == (localizations.firstDayOfWeekIndex - 1) % 7) {
break;
}
}
return result;
}
......
......@@ -2093,14 +2093,11 @@ class _DayHeaders extends StatelessWidget {
///
List<Widget> _getDayHeaders(TextStyle headerStyle, MaterialLocalizations localizations) {
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];
result.add(ExcludeSemantics(
child: Center(child: Text(weekday, style: headerStyle)),
));
if (i == (localizations.firstDayOfWeekIndex - 1) % 7) {
break;
}
}
return result;
}
......@@ -2512,13 +2509,9 @@ class _MonthItemState extends State<_MonthItem> {
final double gridHeight = weeks * _monthItemRowHeight + (weeks - 1) * _monthItemSpaceBetweenRows;
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
// a leap year.
final int day = i - dayOffset + 1;
if (day > daysInMonth) {
break;
}
// 1-based day of month, e.g. 1-31 for January, and 1-29 for February on
// a leap year.
for (int day = 0 - dayOffset + 1; day <= daysInMonth; day += 1) {
if (day < 1) {
dayItems.add(Container());
} else {
......
......@@ -1830,7 +1830,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
double correction;
double effectiveExtent;
do {
while (true) {
correction = _attemptLayout(mainAxisExtent, crossAxisExtent, offset.pixels);
if (correction != 0.0) {
offset.correctBy(correction);
......@@ -1847,7 +1847,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
break;
}
}
} while (true);
}
switch (axis) {
case Axis.vertical:
size = constraints.constrainDimensions(crossAxisExtent, effectiveExtent);
......
......@@ -486,7 +486,7 @@ abstract class FlutterCommand extends Command<void> {
}
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)
if (false) { // ignore: dead_code
if (false) { // ignore: dead_code, literal_only_boolean_expressions
if (ddsEnabled) {
globals.printWarning('${globals.logger.terminal
.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