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
6cff3383
Unverified
Commit
6cff3383
authored
Nov 16, 2020
by
Ian Hickson
Committed by
GitHub
Nov 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More lints (#70500)
parent
9a2bf0e7
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
54 additions
and
50 deletions
+54
-50
analysis_options.yaml
analysis_options.yaml
+9
-9
filtered_child_animation.dart
...rks/macrobenchmarks/lib/src/filtered_child_animation.dart
+15
-15
recorder.dart
dev/benchmarks/macrobenchmarks/lib/src/web/recorder.dart
+7
-2
analysis_options.yaml
packages/analysis_options.yaml
+4
-3
analysis_options.yaml
packages/flutter/analysis_options.yaml
+0
-3
date_picker.dart
packages/flutter/lib/src/cupertino/date_picker.dart
+1
-1
search_field.dart
packages/flutter/lib/src/cupertino/search_field.dart
+1
-1
mouse_cursor.dart
packages/flutter/lib/src/rendering/mouse_cursor.dart
+1
-1
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+1
-1
implicit_animations.dart
packages/flutter/lib/src/widgets/implicit_animations.dart
+1
-1
unique_widget.dart
packages/flutter/lib/src/widgets/unique_widget.dart
+1
-1
synchronous_future_test.dart
...ages/flutter/test/foundation/synchronous_future_test.dart
+3
-2
mocks_for_image_cache.dart
packages/flutter/test/painting/mocks_for_image_cache.dart
+2
-2
implicit_animations_test.dart
packages/flutter/test/widgets/implicit_animations_test.dart
+1
-1
scroll_physics_test.dart
packages/flutter/test/widgets/scroll_physics_test.dart
+2
-2
semantics_tester.dart
packages/flutter/test/widgets/semantics_tester.dart
+1
-1
widget_inspector_test.dart
packages/flutter/test/widgets/widget_inspector_test.dart
+1
-1
driver.dart
packages/flutter_driver/lib/src/driver/driver.dart
+1
-1
widgets_test.dart
packages/flutter_localizations/test/widgets_test.dart
+2
-2
No files found.
analysis_options.yaml
View file @
6cff3383
...
...
@@ -83,7 +83,7 @@ linter:
-
avoid_returning_null_for_void
# - avoid_returning_this # there are plenty of valid reasons to return this
# - avoid_setters_without_getters # not yet tested
# - avoid_shadowing_type_parameters # not yet tested
-
avoid_shadowing_type_parameters
-
avoid_single_cascade_in_expression_statements
-
avoid_slow_async_io
# - avoid_type_to_string # we do this commonly
...
...
@@ -103,7 +103,7 @@ linter:
# - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
# - 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
yet tested
# - curly_braces_in_flow_control_structures # not
required by flutter style
# - diagnostic_describe_all_properties # not yet tested
-
directives_ordering
# - do_not_use_environment # we do this commonly
...
...
@@ -117,22 +117,22 @@ linter:
-
implementation_imports
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
-
iterable_contains_unrelated_type
# - join_return_with_assignment # not
yet tested
# - join_return_with_assignment # not
required by flutter style
-
leading_newlines_in_multiline_strings
-
library_names
-
library_prefixes
# - lines_longer_than_80_chars # not
yet tested
# - lines_longer_than_80_chars # not
required by flutter style
-
list_remove_unrelated_type
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
# - missing_whitespace_between_adjacent_strings # not yet tested
-
no_adjacent_strings_in_list
# - no_default_cases # too many false positives
-
no_duplicate_case_values
# - no_logic_in_create_state # not yet tested
# - no_runtimeType_toString #
not yet tested
-
no_logic_in_create_state
# - no_runtimeType_toString #
ok in tests; we enable this only in packages/
-
non_constant_identifier_names
-
null
_check_on_nullable_type_parameter
# - null_closures
# not yet tested
# - null_closures
# not required by flutter style
# - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
...
...
@@ -143,14 +143,14 @@ linter:
# - parameter_assignments # we do this commonly
-
prefer_adjacent_string_concatenation
-
prefer_asserts_in_initializer_lists
# - prefer_asserts_with_message # not
yet tested
# - prefer_asserts_with_message # not
required by flutter style
-
prefer_collection_literals
-
prefer_conditional_assignment
-
prefer_const_constructors
-
prefer_const_constructors_in_immutables
-
prefer_const_declarations
-
prefer_const_literals_to_create_immutables
# - prefer_constructors_over_static_methods #
not yet tested
# - prefer_constructors_over_static_methods #
far too many false positives
-
prefer_contains
# - prefer_double_quotes # opposite of prefer_single_quotes
-
prefer_equal_for_default_values
...
...
dev/benchmarks/macrobenchmarks/lib/src/filtered_child_animation.dart
View file @
6cff3383
...
...
@@ -12,34 +12,34 @@ enum FilterType {
}
class
FilteredChildAnimationPage
extends
StatefulWidget
{
const
FilteredChildAnimationPage
(
this
.
_filterType
,
[
this
.
_complexChild
=
true
,
this
.
_useRepaintBoundary
=
true
,
]);
const
FilteredChildAnimationPage
(
this
.
initialFilterType
,
[
this
.
initialComplexChild
=
true
,
this
.
initialUseRepaintBoundary
=
true
,
]);
final
FilterType
_f
ilterType
;
final
bool
_c
omplexChild
;
final
bool
_u
seRepaintBoundary
;
final
FilterType
initialF
ilterType
;
final
bool
initialC
omplexChild
;
final
bool
initialU
seRepaintBoundary
;
@override
_FilteredChildAnimationPageState
createState
()
=>
_FilteredChildAnimationPageState
(
_filterType
,
_complexChild
,
_useRepaintBoundary
);
_FilteredChildAnimationPageState
createState
()
=>
_FilteredChildAnimationPageState
();
}
class
_FilteredChildAnimationPageState
extends
State
<
FilteredChildAnimationPage
>
with
SingleTickerProviderStateMixin
{
_FilteredChildAnimationPageState
(
this
.
_filterType
,
this
.
_complexChild
,
this
.
_useRepaintBoundary
);
AnimationController
_controller
;
bool
_useRepaintBoundary
;
bool
_complexChild
;
FilterType
_filterType
;
final
GlobalKey
_childKey
=
GlobalKey
(
debugLabel:
'child to animate'
);
Offset
_childCenter
=
Offset
.
zero
;
FilterType
_filterType
;
bool
_complexChild
;
bool
_useRepaintBoundary
;
@override
void
initState
()
{
super
.
initState
();
_filterType
=
widget
.
initialFilterType
;
_complexChild
=
widget
.
initialComplexChild
;
_useRepaintBoundary
=
widget
.
initialUseRepaintBoundary
;
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
final
RenderBox
childBox
=
_childKey
.
currentContext
.
findRenderObject
()
as
RenderBox
;
_childCenter
=
childBox
.
paintBounds
.
center
;
...
...
dev/benchmarks/macrobenchmarks/lib/src/web/recorder.dart
View file @
6cff3383
...
...
@@ -528,11 +528,16 @@ class _WidgetBuildRecorderHost extends StatefulWidget {
final
WidgetBuildRecorder
recorder
;
@override
State
<
StatefulWidget
>
createState
()
=>
recorder
.
_hostState
=
_WidgetBuildRecorderHostState
();
State
<
StatefulWidget
>
createState
()
=>
_WidgetBuildRecorderHostState
();
}
class
_WidgetBuildRecorderHostState
extends
State
<
_WidgetBuildRecorderHost
>
{
@override
void
initState
()
{
super
.
initState
();
widget
.
recorder
.
_hostState
=
this
;
}
// This is just to bypass the @protected on setState.
void
_setStateTrampoline
()
{
setState
(()
{});
...
...
packages/analysis_options.yaml
View file @
6cff3383
# Take our settings from the repo's main analysis_options.yaml file,
but
include
# a
n additional rule to validate that public members are documented
.
# Take our settings from the repo's main analysis_options.yaml file,
and
include
# a
dditional rules that are specific to production code
.
include
:
../analysis_options.yaml
linter
:
rules
:
-
public_member_api_docs
-
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
packages/flutter/analysis_options.yaml
View file @
6cff3383
...
...
@@ -5,7 +5,4 @@ include: ../analysis_options.yaml
analyzer
:
errors
:
always_require_non_null_named_parameters
:
false
# not needed with nnbd
type_init_formals
:
false
# https://github.com/dart-lang/linter/issues/2192
unrelated_type_equality_checks
:
false
# https://github.com/dart-lang/linter/issues/2196
void_checks
:
false
# https://github.com/dart-lang/linter/issues/2185
unnecessary_null_comparison
:
false
# Turned off until null-safe rollout is complete.
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
6cff3383
...
...
@@ -369,7 +369,7 @@ class CupertinoDatePicker extends StatefulWidget {
final
Color
?
backgroundColor
;
@override
State
<
StatefulWidget
>
createState
()
{
State
<
StatefulWidget
>
createState
()
{
// ignore: no_logic_in_create_state, https://github.com/flutter/flutter/issues/70499
// The `time` mode and `dateAndTime` mode of the picker share the time
// columns, so they are placed together to one state.
// The `date` mode has different children and is implemented in a different
...
...
packages/flutter/lib/src/cupertino/search_field.dart
View file @
6cff3383
...
...
@@ -136,7 +136,7 @@ class CupertinoSearchTextField extends StatefulWidget {
this
.
backgroundColor
,
this
.
borderRadius
,
this
.
padding
=
const
EdgeInsetsDirectional
.
fromSTEB
(
3.8
,
8
,
5
,
8
),
Color
this
.
itemColor
=
CupertinoColors
.
secondaryLabel
,
this
.
itemColor
=
CupertinoColors
.
secondaryLabel
,
this
.
itemSize
=
20.0
,
this
.
prefixInsets
=
const
EdgeInsetsDirectional
.
fromSTEB
(
6
,
0
,
0
,
4
),
this
.
suffixInsets
=
const
EdgeInsetsDirectional
.
fromSTEB
(
0
,
0
,
5
,
2
),
...
...
packages/flutter/lib/src/rendering/mouse_cursor.dart
View file @
6cff3383
...
...
@@ -375,7 +375,7 @@ class SystemMouseCursor extends MouseCursor {
final
String
kind
;
@override
String
get
debugDescription
=>
'
$
runtimeType
(
$kind
)'
;
String
get
debugDescription
=>
'
$
{objectRuntimeType(this, 'SystemMouseCursor')}
(
$kind
)'
;
@override
@protected
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
6cff3383
...
...
@@ -936,7 +936,7 @@ abstract class StatefulWidget extends Widget {
/// [State] objects.
@protected
@factory
State
createState
();
State
createState
();
// ignore: no_logic_in_create_state, this is the original sin
}
/// Tracks the lifecycle of [State] objects when asserts are enabled.
...
...
packages/flutter/lib/src/widgets/implicit_animations.dart
View file @
6cff3383
...
...
@@ -297,7 +297,7 @@ abstract class ImplicitlyAnimatedWidget extends StatefulWidget {
final
VoidCallback
?
onEnd
;
@override
ImplicitlyAnimatedWidgetState
<
ImplicitlyAnimatedWidget
>
createState
();
ImplicitlyAnimatedWidgetState
<
ImplicitlyAnimatedWidget
>
createState
();
// ignore: no_logic_in_create_state, https://github.com/dart-lang/linter/issues/2345
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
...
...
packages/flutter/lib/src/widgets/unique_widget.dart
View file @
6cff3383
...
...
@@ -28,7 +28,7 @@ abstract class UniqueWidget<T extends State<StatefulWidget>> extends StatefulWid
super
(
key:
key
);
@override
T
createState
();
T
createState
();
// ignore: no_logic_in_create_state, https://github.com/dart-lang/linter/issues/2345
/// The state for the unique inflated instance of this widget.
///
...
...
packages/flutter/test/foundation/synchronous_future_test.dart
View file @
6cff3383
...
...
@@ -27,8 +27,9 @@ void main() {
expect
(
await
stream
.
single
,
equals
(
42
));
bool
ranAction
=
false
;
final
Future
<
int
>
completeResult
=
future
.
whenComplete
(()
{
final
Future
<
int
>
completeResult
=
future
.
whenComplete
(()
{
// ignore: void_checks, https://github.com/dart-lang/linter/issues/1675
ranAction
=
true
;
// verify that whenComplete does NOT propagate its return value:
return
Future
<
int
>.
value
(
31
);
});
...
...
@@ -39,7 +40,7 @@ void main() {
Object
?
exception
;
try
{
await
future
.
whenComplete
(()
{
await
future
.
whenComplete
(()
{
// ignore: void_checks, https://github.com/dart-lang/linter/issues/1675
throw
ArgumentError
();
});
// Unreached.
...
...
packages/flutter/test/painting/mocks_for_image_cache.dart
View file @
6cff3383
...
...
@@ -24,7 +24,7 @@ class TestImageInfo implements ImageInfo {
final
int
value
;
@override
String
toString
()
=>
'
$
runtimeType
(
$value
)'
;
String
toString
()
=>
'
$
{objectRuntimeType(this, 'TestImageInfo')}
(
$value
)'
;
@override
TestImageInfo
clone
()
{
...
...
@@ -81,7 +81,7 @@ class TestImageProvider extends ImageProvider<int> {
}
@override
String
toString
()
=>
'
$
runtimeType
(
$key
,
$imageValue
)'
;
String
toString
()
=>
'
$
{objectRuntimeType(this, 'TestImageProvider')}
(
$key
,
$imageValue
)'
;
}
class
FailingTestImageProvider
extends
TestImageProvider
{
...
...
packages/flutter/test/widgets/implicit_animations_test.dart
View file @
6cff3383
...
...
@@ -374,7 +374,7 @@ class TestAnimatedWidget extends StatefulWidget {
final
State
<
StatefulWidget
>
state
;
@override
State
<
StatefulWidget
>
createState
()
=>
state
;
State
<
StatefulWidget
>
createState
()
=>
state
;
// ignore: no_logic_in_create_state, this test predates the lint
}
abstract
class
_TestAnimatedWidgetState
extends
State
<
TestAnimatedWidget
>
{
...
...
packages/flutter/test/widgets/scroll_physics_test.dart
View file @
6cff3383
...
...
@@ -29,8 +29,8 @@ class TestScrollPhysics extends ScrollPhysics {
@override
String
toString
()
{
if
(
parent
==
null
)
return
'
$
runtimeType
(
$name
)'
;
return
'
$
runtimeType
(
$name
) ->
$parent
'
;
return
'
$
{objectRuntimeType(this, 'TestScrollPhysics')}
(
$name
)'
;
return
'
$
{objectRuntimeType(this, 'TestScrollPhysics')}
(
$name
) ->
$parent
'
;
}
}
...
...
packages/flutter/test/widgets/semantics_tester.dart
View file @
6cff3383
...
...
@@ -349,7 +349,7 @@ class TestSemantics {
String
toString
([
int
indentAmount
=
0
])
{
final
String
indent
=
' '
*
indentAmount
;
final
StringBuffer
buf
=
StringBuffer
();
buf
.
writeln
(
'
$indent$
runtimeType
('
);
buf
.
writeln
(
'
$indent$
{objectRuntimeType(this, 'TestSemantics')}
('
);
if
(
id
!=
null
)
buf
.
writeln
(
'
$indent
id:
$id
,'
);
if
(
flags
is
int
&&
flags
!=
0
||
flags
is
List
<
SemanticsFlag
>
&&
(
flags
as
List
<
SemanticsFlag
>).
isNotEmpty
)
...
...
packages/flutter/test/widgets/widget_inspector_test.dart
View file @
6cff3383
...
...
@@ -114,7 +114,7 @@ class CyclicDiagnostic extends DiagnosticableTree {
final
String
name
;
@override
String
toStringShort
()
=>
'
$
runtimeType
-
$name
'
;
String
toStringShort
()
=>
'
$
{objectRuntimeType(this, 'CyclicDiagnistic')}
-
$name
'
;
// We have to override toString to avoid the toString call itself triggering a
// stack overflow.
...
...
packages/flutter_driver/lib/src/driver/driver.dart
View file @
6cff3383
...
...
@@ -777,7 +777,7 @@ class DriverOffset {
final
double
dy
;
@override
String
toString
()
=>
'
$runtimeType
(
$dx
,
$dy
)'
;
String
toString
()
=>
'
$runtimeType
(
$dx
,
$dy
)'
;
// ignore: no_runtimetype_tostring, can't access package:flutter here to use objectRuntimeType
@override
bool
operator
==(
Object
other
)
{
...
...
packages/flutter_localizations/test/widgets_test.dart
View file @
6cff3383
...
...
@@ -52,7 +52,7 @@ class SyncTestLocalizationsDelegate extends LocalizationsDelegate<TestLocalizati
}
@override
String
toString
()
=>
'
$
runtimeType
(
$prefix
)'
;
String
toString
()
=>
'
$
{objectRuntimeType(this, 'SyncTestLocalizationsDelegate')}
(
$prefix
)'
;
}
class
AsyncTestLocalizationsDelegate
extends
LocalizationsDelegate
<
TestLocalizations
>
{
...
...
@@ -74,7 +74,7 @@ class AsyncTestLocalizationsDelegate extends LocalizationsDelegate<TestLocalizat
}
@override
String
toString
()
=>
'
$
runtimeType
(
$prefix
)'
;
String
toString
()
=>
'
$
{objectRuntimeType(this, 'AsyncTestLocalizationsDelegate')}
(
$prefix
)'
;
}
class
MoreLocalizations
{
...
...
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