Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
fecf99ff
Unverified
Commit
fecf99ff
authored
Jun 25, 2019
by
Alexandre Ardhuin
Committed by
GitHub
Jun 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable lint avoid_bool_literals_in_conditional_expressions (#35055)
parent
9a3a7490
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
27 additions
and
25 deletions
+27
-25
analysis_options.yaml
analysis_options.yaml
+1
-1
analyze-sample-code.dart
dev/bots/analyze-sample-code.dart
+1
-1
chip_demo.dart
examples/flutter_gallery/lib/demo/material/chip_demo.dart
+1
-1
route.dart
packages/flutter/lib/src/cupertino/route.dart
+2
-2
diagnostics.dart
packages/flutter/lib/src/foundation/diagnostics.dart
+1
-1
bottom_navigation_bar.dart
packages/flutter/lib/src/material/bottom_navigation_bar.dart
+1
-1
chip.dart
packages/flutter/lib/src/material/chip.dart
+1
-1
data_table.dart
packages/flutter/lib/src/material/data_table.dart
+1
-1
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+1
-1
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+1
-1
tab_controller.dart
packages/flutter/lib/src/material/tab_controller.dart
+1
-1
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+1
-1
text_input.dart
packages/flutter/lib/src/services/text_input.dart
+1
-1
dismissible.dart
packages/flutter/lib/src/widgets/dismissible.dart
+1
-1
widget_span.dart
packages/flutter/lib/src/widgets/widget_span.dart
+5
-3
box_test.dart
packages/flutter/test/rendering/box_test.dart
+1
-1
override_test.dart
packages/flutter_localizations/test/override_test.dart
+1
-1
build.dart
packages/flutter_tools/lib/src/base/build.dart
+1
-1
io.dart
packages/flutter_tools/lib/src/base/io.dart
+1
-1
process.dart
packages/flutter_tools/lib/src/base/process.dart
+2
-2
compile.dart
packages/flutter_tools/lib/src/compile.dart
+1
-1
No files found.
analysis_options.yaml
View file @
fecf99ff
...
@@ -52,7 +52,7 @@ linter:
...
@@ -52,7 +52,7 @@ linter:
-
annotate_overrides
-
annotate_overrides
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
-
avoid_as
-
avoid_as
# - avoid_bool_literals_in_conditional_expressions # not yet tested
-
avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses # we do this commonly
# - avoid_catches_without_on_clauses # we do this commonly
# - avoid_catching_errors # we do this commonly
# - avoid_catching_errors # we do this commonly
-
avoid_classes_with_only_static_members
-
avoid_classes_with_only_static_members
...
...
dev/bots/analyze-sample-code.dart
View file @
fecf99ff
...
@@ -430,7 +430,7 @@ class SampleChecker {
...
@@ -430,7 +430,7 @@ class SampleChecker {
startLine
=
Line
(
''
,
filename:
relativeFilePath
,
line:
lineNumber
+
1
,
indent:
3
);
startLine
=
Line
(
''
,
filename:
relativeFilePath
,
line:
lineNumber
+
1
,
indent:
3
);
inPreamble
=
true
;
inPreamble
=
true
;
}
else
if
(
sampleMatch
!=
null
)
{
}
else
if
(
sampleMatch
!=
null
)
{
inSnippet
=
sampleMatch
!=
null
?
sampleMatch
[
1
]
==
'snippet'
:
false
;
inSnippet
=
sampleMatch
!=
null
&&
sampleMatch
[
1
]
==
'snippet'
;
if
(
inSnippet
)
{
if
(
inSnippet
)
{
startLine
=
Line
(
startLine
=
Line
(
''
,
''
,
...
...
examples/flutter_gallery/lib/demo/material/chip_demo.dart
View file @
fecf99ff
...
@@ -247,7 +247,7 @@ class _ChipDemoState extends State<ChipDemo> {
...
@@ -247,7 +247,7 @@ class _ChipDemoState extends State<ChipDemo> {
return
FilterChip
(
return
FilterChip
(
key:
ValueKey
<
String
>(
name
),
key:
ValueKey
<
String
>(
name
),
label:
Text
(
_capitalize
(
name
)),
label:
Text
(
_capitalize
(
name
)),
selected:
_tools
.
contains
(
name
)
?
_selectedTools
.
contains
(
name
)
:
false
,
selected:
_tools
.
contains
(
name
)
&&
_selectedTools
.
contains
(
name
)
,
onSelected:
!
_tools
.
contains
(
name
)
onSelected:
!
_tools
.
contains
(
name
)
?
null
?
null
:
(
bool
value
)
{
:
(
bool
value
)
{
...
...
packages/flutter/lib/src/cupertino/route.dart
View file @
fecf99ff
...
@@ -618,9 +618,9 @@ class _CupertinoBackGestureController<T> {
...
@@ -618,9 +618,9 @@ class _CupertinoBackGestureController<T> {
// or after mid screen, we should animate the page out. Otherwise, the page
// or after mid screen, we should animate the page out. Otherwise, the page
// should be animated back in.
// should be animated back in.
if
(
velocity
.
abs
()
>=
_kMinFlingVelocity
)
if
(
velocity
.
abs
()
>=
_kMinFlingVelocity
)
animateForward
=
velocity
>
0
?
false
:
true
;
animateForward
=
velocity
<=
0
;
else
else
animateForward
=
controller
.
value
>
0.5
?
true
:
false
;
animateForward
=
controller
.
value
>
0.5
;
if
(
animateForward
)
{
if
(
animateForward
)
{
// The closer the panel is to dismissing, the shorter the animation is.
// The closer the panel is to dismissing, the shorter the animation is.
...
...
packages/flutter/lib/src/foundation/diagnostics.dart
View file @
fecf99ff
...
@@ -1469,7 +1469,7 @@ abstract class DiagnosticsNode {
...
@@ -1469,7 +1469,7 @@ abstract class DiagnosticsNode {
///
///
/// If `minLevel` is [DiagnosticLevel.hidden] no diagnostics will be filtered.
/// If `minLevel` is [DiagnosticLevel.hidden] no diagnostics will be filtered.
/// If `minLevel` is [DiagnosticLevel.off] all diagnostics will be filtered.
/// If `minLevel` is [DiagnosticLevel.off] all diagnostics will be filtered.
bool
isFiltered
(
DiagnosticLevel
minLevel
)
=>
kReleaseMode
?
true
:
level
.
index
<
minLevel
.
index
;
bool
isFiltered
(
DiagnosticLevel
minLevel
)
=>
kReleaseMode
||
level
.
index
<
minLevel
.
index
;
/// Priority level of the diagnostic used to control which diagnostics should
/// Priority level of the diagnostic used to control which diagnostics should
/// be shown and filtered.
/// be shown and filtered.
...
...
packages/flutter/lib/src/material/bottom_navigation_bar.dart
View file @
fecf99ff
...
@@ -197,7 +197,7 @@ class BottomNavigationBar extends StatefulWidget {
...
@@ -197,7 +197,7 @@ class BottomNavigationBar extends StatefulWidget {
assert
(
elevation
!=
null
&&
elevation
>=
0.0
),
assert
(
elevation
!=
null
&&
elevation
>=
0.0
),
assert
(
iconSize
!=
null
&&
iconSize
>=
0.0
),
assert
(
iconSize
!=
null
&&
iconSize
>=
0.0
),
assert
(
assert
(
selectedItemColor
!=
null
?
fixedColor
==
null
:
true
,
selectedItemColor
==
null
||
fixedColor
==
null
,
'Either selectedItemColor or fixedColor can be specified, but not both'
'Either selectedItemColor or fixedColor can be specified, but not both'
),
),
assert
(
selectedFontSize
!=
null
&&
selectedFontSize
>=
0.0
),
assert
(
selectedFontSize
!=
null
&&
selectedFontSize
>=
0.0
),
...
...
packages/flutter/lib/src/material/chip.dart
View file @
fecf99ff
...
@@ -1410,7 +1410,7 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
...
@@ -1410,7 +1410,7 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
}
}
bool
_isTapping
=
false
;
bool
_isTapping
=
false
;
bool
get
isTapping
=>
!
canTap
?
false
:
_isTapping
;
bool
get
isTapping
=>
canTap
&&
_isTapping
;
@override
@override
void
initState
()
{
void
initState
()
{
...
...
packages/flutter/lib/src/material/data_table.dart
View file @
fecf99ff
...
@@ -616,7 +616,7 @@ class DataTable extends StatelessWidget {
...
@@ -616,7 +616,7 @@ class DataTable extends StatelessWidget {
label:
column
.
label
,
label:
column
.
label
,
tooltip:
column
.
tooltip
,
tooltip:
column
.
tooltip
,
numeric:
column
.
numeric
,
numeric:
column
.
numeric
,
onSort:
()
=>
column
.
onSort
!=
null
?
column
.
onSort
(
dataColumnIndex
,
sortColumnIndex
==
dataColumnIndex
?
!
sortAscending
:
true
)
:
null
,
onSort:
()
=>
column
.
onSort
!=
null
?
column
.
onSort
(
dataColumnIndex
,
sortColumnIndex
!=
dataColumnIndex
||
!
sortAscending
)
:
null
,
sorted:
dataColumnIndex
==
sortColumnIndex
,
sorted:
dataColumnIndex
==
sortColumnIndex
,
ascending:
sortAscending
,
ascending:
sortAscending
,
);
);
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
fecf99ff
...
@@ -346,7 +346,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
...
@@ -346,7 +346,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
break
;
break
;
}
}
final
bool
opened
=
_controller
.
value
>
0.5
?
true
:
false
;
final
bool
opened
=
_controller
.
value
>
0.5
;
if
(
opened
!=
_previouslyOpened
&&
widget
.
drawerCallback
!=
null
)
if
(
opened
!=
_previouslyOpened
&&
widget
.
drawerCallback
!=
null
)
widget
.
drawerCallback
(
opened
);
widget
.
drawerCallback
(
opened
);
_previouslyOpened
=
opened
;
_previouslyOpened
=
opened
;
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
fecf99ff
...
@@ -2173,7 +2173,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
...
@@ -2173,7 +2173,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
);
);
// extendBody locked when keyboard is open
// extendBody locked when keyboard is open
final
bool
_extendBody
=
minInsets
.
bottom
>
0
?
false
:
widget
.
extendBody
;
final
bool
_extendBody
=
minInsets
.
bottom
<=
0
&&
widget
.
extendBody
;
return
_ScaffoldScope
(
return
_ScaffoldScope
(
hasDrawer:
hasDrawer
,
hasDrawer:
hasDrawer
,
...
...
packages/flutter/lib/src/material/tab_controller.dart
View file @
fecf99ff
...
@@ -150,7 +150,7 @@ class TabController extends ChangeNotifier {
...
@@ -150,7 +150,7 @@ class TabController extends ChangeNotifier {
void
_changeIndex
(
int
value
,
{
Duration
duration
,
Curve
curve
})
{
void
_changeIndex
(
int
value
,
{
Duration
duration
,
Curve
curve
})
{
assert
(
value
!=
null
);
assert
(
value
!=
null
);
assert
(
value
>=
0
&&
(
value
<
length
||
length
==
0
));
assert
(
value
>=
0
&&
(
value
<
length
||
length
==
0
));
assert
(
duration
==
null
?
curve
==
null
:
true
);
assert
(
duration
!=
null
||
curve
==
null
);
assert
(
_indexIsChangingCount
>=
0
);
assert
(
_indexIsChangingCount
>=
0
);
if
(
value
==
_index
||
length
<
2
)
if
(
value
==
_index
||
length
<
2
)
return
;
return
;
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
fecf99ff
...
@@ -2969,7 +2969,7 @@ class RenderIgnorePointer extends RenderProxyBox {
...
@@ -2969,7 +2969,7 @@ class RenderIgnorePointer extends RenderProxyBox {
@override
@override
bool
hitTest
(
BoxHitTestResult
result
,
{
Offset
position
})
{
bool
hitTest
(
BoxHitTestResult
result
,
{
Offset
position
})
{
return
ignoring
?
false
:
super
.
hitTest
(
result
,
position:
position
);
return
!
ignoring
&&
super
.
hitTest
(
result
,
position:
position
);
}
}
// TODO(ianh): figure out a way to still include labels and flags in
// TODO(ianh): figure out a way to still include labels and flags in
...
...
packages/flutter/lib/src/services/text_input.dart
View file @
fecf99ff
...
@@ -469,7 +469,7 @@ class RawFloatingCursorPoint {
...
@@ -469,7 +469,7 @@ class RawFloatingCursorPoint {
this
.
offset
,
this
.
offset
,
@required
this
.
state
,
@required
this
.
state
,
})
:
assert
(
state
!=
null
),
})
:
assert
(
state
!=
null
),
assert
(
state
==
FloatingCursorDragState
.
Update
?
offset
!=
null
:
true
);
assert
(
state
!=
FloatingCursorDragState
.
Update
||
offset
!=
null
);
/// The raw position of the floating cursor as determined by the iOS sdk.
/// The raw position of the floating cursor as determined by the iOS sdk.
final
Offset
offset
;
final
Offset
offset
;
...
...
packages/flutter/lib/src/widgets/dismissible.dart
View file @
fecf99ff
...
@@ -95,7 +95,7 @@ class Dismissible extends StatefulWidget {
...
@@ -95,7 +95,7 @@ class Dismissible extends StatefulWidget {
this
.
crossAxisEndOffset
=
0.0
,
this
.
crossAxisEndOffset
=
0.0
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
})
:
assert
(
key
!=
null
),
})
:
assert
(
key
!=
null
),
assert
(
secondaryBackground
!=
null
?
background
!=
null
:
true
),
assert
(
secondaryBackground
==
null
||
background
!=
null
),
assert
(
dragStartBehavior
!=
null
),
assert
(
dragStartBehavior
!=
null
),
super
(
key:
key
);
super
(
key:
key
);
...
...
packages/flutter/lib/src/widgets/widget_span.dart
View file @
fecf99ff
...
@@ -75,9 +75,11 @@ class WidgetSpan extends PlaceholderSpan {
...
@@ -75,9 +75,11 @@ class WidgetSpan extends PlaceholderSpan {
TextBaseline
baseline
,
TextBaseline
baseline
,
TextStyle
style
,
TextStyle
style
,
})
:
assert
(
child
!=
null
),
})
:
assert
(
child
!=
null
),
assert
((
identical
(
alignment
,
ui
.
PlaceholderAlignment
.
aboveBaseline
)
||
assert
(
baseline
!=
null
||
!(
identical
(
alignment
,
ui
.
PlaceholderAlignment
.
belowBaseline
)
||
identical
(
alignment
,
ui
.
PlaceholderAlignment
.
aboveBaseline
)
||
identical
(
alignment
,
ui
.
PlaceholderAlignment
.
baseline
))
?
baseline
!=
null
:
true
),
identical
(
alignment
,
ui
.
PlaceholderAlignment
.
belowBaseline
)
||
identical
(
alignment
,
ui
.
PlaceholderAlignment
.
baseline
)
)),
super
(
super
(
alignment:
alignment
,
alignment:
alignment
,
baseline:
baseline
,
baseline:
baseline
,
...
...
packages/flutter/test/rendering/box_test.dart
View file @
fecf99ff
...
@@ -25,7 +25,7 @@ class FakeMissingSizeRenderBox extends RenderBox {
...
@@ -25,7 +25,7 @@ class FakeMissingSizeRenderBox extends RenderBox {
}
}
@override
@override
bool
get
hasSize
=>
fakeMissingSize
?
false
:
super
.
hasSize
;
bool
get
hasSize
=>
!
fakeMissingSize
&&
super
.
hasSize
;
bool
fakeMissingSize
=
false
;
bool
fakeMissingSize
=
false
;
}
}
...
...
packages/flutter_localizations/test/override_test.dart
View file @
fecf99ff
...
@@ -37,7 +37,7 @@ class FooMaterialLocalizationsDelegate extends LocalizationsDelegate<MaterialLoc
...
@@ -37,7 +37,7 @@ class FooMaterialLocalizationsDelegate extends LocalizationsDelegate<MaterialLoc
@override
@override
bool
isSupported
(
Locale
locale
)
{
bool
isSupported
(
Locale
locale
)
{
return
supportedLanguage
==
'allLanguages'
?
true
:
locale
.
languageCode
==
supportedLanguage
;
return
supportedLanguage
==
'allLanguages'
||
locale
.
languageCode
==
supportedLanguage
;
}
}
@override
@override
...
...
packages/flutter_tools/lib/src/base/build.dart
View file @
fecf99ff
...
@@ -175,7 +175,7 @@ class AOTSnapshotter {
...
@@ -175,7 +175,7 @@ class AOTSnapshotter {
'entryPoint'
:
mainPath
,
'entryPoint'
:
mainPath
,
'extraGenSnapshotOptions'
:
extraGenSnapshotOptions
.
join
(
' '
),
'extraGenSnapshotOptions'
:
extraGenSnapshotOptions
.
join
(
' '
),
'engineHash'
:
Cache
.
instance
.
engineRevision
,
'engineHash'
:
Cache
.
instance
.
engineRevision
,
'buildersUsed'
:
'
${flutterProject != null
? flutterProject.hasBuilders : false
}
'
,
'buildersUsed'
:
'
${flutterProject != null
&& flutterProject.hasBuilders
}
'
,
},
},
depfilePaths:
<
String
>[],
depfilePaths:
<
String
>[],
);
);
...
...
packages/flutter_tools/lib/src/base/io.dart
View file @
fecf99ff
...
@@ -163,7 +163,7 @@ class Stdio {
...
@@ -163,7 +163,7 @@ class Stdio {
bool
get
hasTerminal
=>
io
.
stdout
.
hasTerminal
;
bool
get
hasTerminal
=>
io
.
stdout
.
hasTerminal
;
int
get
terminalColumns
=>
hasTerminal
?
io
.
stdout
.
terminalColumns
:
null
;
int
get
terminalColumns
=>
hasTerminal
?
io
.
stdout
.
terminalColumns
:
null
;
int
get
terminalLines
=>
hasTerminal
?
io
.
stdout
.
terminalLines
:
null
;
int
get
terminalLines
=>
hasTerminal
?
io
.
stdout
.
terminalLines
:
null
;
bool
get
supportsAnsiEscapes
=>
hasTerminal
?
io
.
stdout
.
supportsAnsiEscapes
:
false
;
bool
get
supportsAnsiEscapes
=>
hasTerminal
&&
io
.
stdout
.
supportsAnsiEscapes
;
}
}
Stdio
get
stdio
=>
context
.
get
<
Stdio
>()
??
const
Stdio
();
Stdio
get
stdio
=>
context
.
get
<
Stdio
>()
??
const
Stdio
();
...
...
packages/flutter_tools/lib/src/base/process.dart
View file @
fecf99ff
...
@@ -148,7 +148,7 @@ Future<int> runCommandAndStreamOutput(
...
@@ -148,7 +148,7 @@ Future<int> runCommandAndStreamOutput(
final
StreamSubscription
<
String
>
stdoutSubscription
=
process
.
stdout
final
StreamSubscription
<
String
>
stdoutSubscription
=
process
.
stdout
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
transform
<
String
>(
const
LineSplitter
())
.
where
((
String
line
)
=>
filter
==
null
?
true
:
filter
.
hasMatch
(
line
))
.
where
((
String
line
)
=>
filter
==
null
||
filter
.
hasMatch
(
line
))
.
listen
((
String
line
)
{
.
listen
((
String
line
)
{
if
(
mapFunction
!=
null
)
if
(
mapFunction
!=
null
)
line
=
mapFunction
(
line
);
line
=
mapFunction
(
line
);
...
@@ -163,7 +163,7 @@ Future<int> runCommandAndStreamOutput(
...
@@ -163,7 +163,7 @@ Future<int> runCommandAndStreamOutput(
final
StreamSubscription
<
String
>
stderrSubscription
=
process
.
stderr
final
StreamSubscription
<
String
>
stderrSubscription
=
process
.
stderr
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
transform
<
String
>(
const
LineSplitter
())
.
where
((
String
line
)
=>
filter
==
null
?
true
:
filter
.
hasMatch
(
line
))
.
where
((
String
line
)
=>
filter
==
null
||
filter
.
hasMatch
(
line
))
.
listen
((
String
line
)
{
.
listen
((
String
line
)
{
if
(
mapFunction
!=
null
)
if
(
mapFunction
!=
null
)
line
=
mapFunction
(
line
);
line
=
mapFunction
(
line
);
...
...
packages/flutter_tools/lib/src/compile.dart
View file @
fecf99ff
...
@@ -246,7 +246,7 @@ class KernelCompiler {
...
@@ -246,7 +246,7 @@ class KernelCompiler {
'trackWidgetCreation'
:
trackWidgetCreation
.
toString
(),
'trackWidgetCreation'
:
trackWidgetCreation
.
toString
(),
'linkPlatformKernelIn'
:
linkPlatformKernelIn
.
toString
(),
'linkPlatformKernelIn'
:
linkPlatformKernelIn
.
toString
(),
'engineHash'
:
Cache
.
instance
.
engineRevision
,
'engineHash'
:
Cache
.
instance
.
engineRevision
,
'buildersUsed'
:
'
${flutterProject != null
? flutterProject.hasBuilders : false
}
'
,
'buildersUsed'
:
'
${flutterProject != null
&& flutterProject.hasBuilders
}
'
,
},
},
depfilePaths:
<
String
>[
depFilePath
],
depfilePaths:
<
String
>[
depFilePath
],
pathFilter:
(
String
path
)
=>
!
path
.
startsWith
(
'/b/build/slave/'
),
pathFilter:
(
String
path
)
=>
!
path
.
startsWith
(
'/b/build/slave/'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment