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
94636bd2
Commit
94636bd2
authored
May 20, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup based on new lints (#4052)
parent
4052aa71
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
88 additions
and
39 deletions
+88
-39
.analysis_options
.analysis_options
+26
-11
assertions.dart
packages/flutter/lib/src/foundation/assertions.dart
+1
-1
box.dart
packages/flutter/lib/src/rendering/box.dart
+5
-0
focus.dart
packages/flutter/lib/src/widgets/focus.dart
+7
-2
lazy_block_viewport_test.dart
packages/flutter/test/widget/lazy_block_viewport_test.dart
+2
-2
flutter_analysis_options
packages/flutter_tools/flutter_analysis_options
+25
-4
executable.dart
packages/flutter_tools/lib/executable.dart
+17
-14
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+1
-1
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+2
-2
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+1
-1
bundle_test.dart
packages/flx/test/bundle_test.dart
+1
-1
No files found.
.analysis_options
View file @
94636bd2
# Specify analysis options.
#
# Note that until there is a default "all-in" lint rule-set we need
# to opt-in to all desired lints (https://github.com/dart-lang/sdk/issues/25843).
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
# This file is the .analysis_options file used by Flutter editors, such as
# Atom. It is very similar to flutter_tools/flutter_analysis_options; the only
...
...
@@ -23,33 +19,52 @@ analyzer:
strong_mode_down_cast_composite: ignore
# we allow having TODOs in the code
todo: ignore
linter:
rules:
# these are in the same order as http://dart-lang.github.io/linter/lints/
# to make maintenance easier
# error rules
- avoid_empty_else
# - comment_references
- control_flow_in_finally
- hash_and_equals
# - iterable_contains_unrelated_type
- test_types_in_equals
- throw_in_finally
- unrelated_type_equality_checks
# style rules
- always_declare_return_types
- always_specify_types
- annotate_overrides
- avoid_as
- avoid_init_to_null
# - avoid_return_types_on_setters # https://github.com/dart-lang/linter/issues/202
- avoid_return_types_on_setters
- await_only_futures
- camel_case_types
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204 (and 203)
# - constant_identifier_names
- control_flow_in_finally
- empty_constructor_bodies
- hash_and_equals
# - implementation_imports # https://github.com/dart-lang/linter/issues/203
- implementation_imports
- library_names
- library_prefixes
- non_constant_identifier_names
# - one_member_abstracts # https://github.com/dart-lang/linter/issues/203
- one_member_abstracts
# - overriden_field
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_is_not_empty
# - public_member_api_docs
- slash_for_doc_comments
- sort_constructors_first
- sort_unnamed_constructors_first
- super_goes_last
- type_annotate_public_apis # subset of always_specify_types
#
- type_annotate_public_apis # subset of always_specify_types
- type_init_formals
- unnecessary_brace_in_string_interp
- unnecessary_getters_setters
# pub rules
- package_names
packages/flutter/lib/src/foundation/assertions.dart
View file @
94636bd2
...
...
@@ -290,7 +290,7 @@ class FlutterError extends AssertionError {
}
result
.
add
(
line
);
}
if
(
skipped
==
1
)
{
if
(
skipped
.
length
==
1
)
{
result
.
add
(
'(elided one frame from
${skipped.single}
)'
);
}
else
if
(
skipped
.
length
>
1
)
{
List
<
String
>
where
=
new
Set
<
String
>.
from
(
skipped
).
toList
()..
sort
();
...
...
packages/flutter/lib/src/rendering/box.dart
View file @
94636bd2
...
...
@@ -963,6 +963,11 @@ abstract class RenderBox extends RenderObject {
int
_debugActivePointers
=
0
;
/// Override this function to handle pointer events that hit this render object.
///
/// For [RenderBox] objects, the `entry` argument is a [BoxHitTestEntry]. From this
/// object you can determine the [PointerDownEvent]'s position in local coordinates.
/// (This is useful because [PointerEvent.position] is in global coordinates.)
@override
void
handleEvent
(
PointerEvent
event
,
HitTestEntry
entry
)
{
super
.
handleEvent
(
event
,
entry
);
...
...
packages/flutter/lib/src/widgets/focus.dart
View file @
94636bd2
...
...
@@ -130,8 +130,13 @@ class Focus extends StatefulWidget {
if
(
debugOnlyFocusedKey
?.
currentContext
==
null
)
debugOnlyFocusedKey
=
context
.
widget
.
key
;
if
(
debugOnlyFocusedKey
!=
context
.
widget
.
key
)
{
debugPrint
(
'Tried to focus widgets with two different keys:
$debugOnlyFocusedKey
and
${context.widget.key}
'
);
assert
(
'If you have more than one focusable widget, then you should put them inside a Focus.'
==
true
);
throw
new
FlutterError
(
'Missing Focus scope.
\n
'
'Two focusable widgets with different keys,
$debugOnlyFocusedKey
and
${context.widget.key}
, '
'exist in the widget tree simultaneously, but they have no Focus widget ancestor.
\n
'
'If you have more than one focusable widget, then you should put them inside a Focus. '
'Normally, this is done for you using a Route, via Navigator, WidgetsApp, or MaterialApp.'
);
}
return
true
;
});
...
...
packages/flutter/test/widget/lazy_block_viewport_test.dart
View file @
94636bd2
...
...
@@ -183,7 +183,7 @@ void main() {
expect
(
callbackTracker
,
equals
(<
int
>[
0
,
1
,
2
]));
callbackTracker
.
clear
();
await
tester
.
allWidgets
.
forEach
(
collectText
);
tester
.
allWidgets
.
forEach
(
collectText
);
expect
(
text
,
equals
(<
String
>[
'0'
,
'1'
,
'2'
]));
text
.
clear
();
...
...
@@ -191,7 +191,7 @@ void main() {
expect
(
callbackTracker
,
equals
(<
int
>[
0
,
1
,
2
]));
callbackTracker
.
clear
();
await
tester
.
allWidgets
.
forEach
(
collectText
);
tester
.
allWidgets
.
forEach
(
collectText
);
expect
(
text
,
equals
(<
String
>[
'0'
,
'1'
,
'2'
]));
text
.
clear
();
});
...
...
packages/flutter_tools/flutter_analysis_options
View file @
94636bd2
...
...
@@ -3,11 +3,13 @@
# Note that until there is a default "all-in" lint rule-set we need
# to opt-in to all desired lints (https://github.com/dart-lang/sdk/issues/25843).
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
#
# This file is the .analysis_options file used by "flutter analyze".
# It isn't named that because otherwise editors like Atom would try
# to use it, and that wouldn't work because it enables things that
# need to be silenced, in particular, public_member_api_docs.
#
# When editing, make sure you keep /.analysis_options consistent.
analyzer:
language:
...
...
@@ -23,26 +25,41 @@ analyzer:
strong_mode_down_cast_composite: ignore
# we allow having TODOs in the code
todo: ignore
linter:
rules:
# these are in the same order as http://dart-lang.github.io/linter/lints/
# to make maintenance easier
# # error rules
- avoid_empty_else
# - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153
- control_flow_in_finally
- hash_and_equals
# - iterable_contains_unrelated_type # https://github.com/dart-lang/linter/issues/245
- test_types_in_equals
- throw_in_finally
- unrelated_type_equality_checks
# style rules
- always_declare_return_types
- always_specify_types
- annotate_overrides
- avoid_as
- avoid_init_to_null
- avoid_return_types_on_setters
- await_only_futures
- camel_case_types
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204 (and 203)
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
- empty_constructor_bodies
- hash_and_equals
- implementation_imports
- library_names
- library_prefixes
- non_constant_identifier_names
- one_member_abstracts
# - overriden_field # the analyzer code itself violates this right now :-)
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_is_not_empty
- public_member_api_docs
...
...
@@ -50,6 +67,10 @@ linter:
- sort_constructors_first
- sort_unnamed_constructors_first
- super_goes_last
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
- unnecessary_brace_in_string_interp
- unnecessary_getters_setters
# pub rules
- package_names
packages/flutter_tools/lib/executable.dart
View file @
94636bd2
...
...
@@ -91,8 +91,10 @@ Future<Null> main(List<String> args) async {
if
(
error
is
UsageException
)
{
stderr
.
writeln
(
error
.
message
);
stderr
.
writeln
();
stderr
.
writeln
(
"Run 'flutter -h' (or 'flutter <command> -h') for available "
"flutter commands and options."
);
stderr
.
writeln
(
"Run 'flutter -h' (or 'flutter <command> -h') for available "
"flutter commands and options."
);
// Argument error exit code.
_exit
(
64
);
}
else
if
(
error
is
ProcessExit
)
{
...
...
@@ -118,7 +120,8 @@ Future<Null> main(List<String> args) async {
stderr
.
writeln
(
'Crash report written to
${file.path}
;
\n
'
'please let us know at https://github.com/flutter/flutter/issues.'
);
'please let us know at https://github.com/flutter/flutter/issues.'
);
}
_exit
(
1
);
...
...
@@ -129,21 +132,21 @@ Future<Null> main(List<String> args) async {
File
_createCrashReport
(
List
<
String
>
args
,
dynamic
error
,
Chain
chain
)
{
File
crashFile
=
getUniqueFile
(
Directory
.
current
,
'flutter'
,
'log'
);
StringBuffer
buf
=
new
StringBuffer
();
StringBuffer
buf
fer
=
new
StringBuffer
();
buf
.
writeln
(
'Flutter crash report; please file at https://github.com/flutter/flutter/issues.
\n
'
);
buf
fer
.
writeln
(
'Flutter crash report; please file at https://github.com/flutter/flutter/issues.
\n
'
);
buf
.
writeln
(
'## command
\n
'
);
buf
.
writeln
(
'flutter
${args.join(' ')}
\n
'
);
buf
fer
.
writeln
(
'## command
\n
'
);
buf
fer
.
writeln
(
'flutter
${args.join(' ')}
\n
'
);
buf
.
writeln
(
'## exception
\n
'
);
buf
.
writeln
(
'
$error
\n
'
);
buf
.
writeln
(
'```
\n
${chain.terse}
```
\n
'
);
buf
fer
.
writeln
(
'## exception
\n
'
);
buf
fer
.
writeln
(
'
$error
\n
'
);
buf
fer
.
writeln
(
'```
\n
${chain.terse}
```
\n
'
);
buf
.
writeln
(
'## flutter doctor
\n
'
);
buf
.
writeln
(
'```
\n
${_doctorText()}
```'
);
buf
fer
.
writeln
(
'## flutter doctor
\n
'
);
buf
fer
.
writeln
(
'```
\n
${_doctorText()}
```'
);
crashFile
.
writeAsStringSync
(
buf
.
toString
());
crashFile
.
writeAsStringSync
(
buf
fer
.
toString
());
return
crashFile
;
}
...
...
@@ -179,7 +182,7 @@ Future<Null> _exit(int code) async {
logger
.
flush
();
// Give the task / timer queue one cycle through before we hard exit.
await
Timer
.
run
(()
{
Timer
.
run
(()
{
printTrace
(
'exiting with code
$code
'
);
exit
(
code
);
});
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
94636bd2
...
...
@@ -261,7 +261,7 @@ Future<int> startApp(DriveCommand command, BuildMode buildMode) async {
printTrace
(
'Installing application package.'
);
ApplicationPackage
package
=
command
.
applicationPackages
.
getPackageForPlatform
(
command
.
device
.
platform
);
await
command
.
device
.
installApp
(
package
);
command
.
device
.
installApp
(
package
);
printTrace
(
'Starting application.'
);
LaunchResult
result
=
await
command
.
device
.
startApp
(
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
94636bd2
...
...
@@ -205,7 +205,7 @@ Future<int> startApp(
if
(
install
&&
device
is
AndroidDevice
)
{
printStatus
(
'Installing
$package
to
$device
...'
);
if
(!(
await
installApp
(
device
,
package
)))
if
(!(
installApp
(
device
,
package
)))
return
1
;
}
...
...
@@ -345,7 +345,7 @@ class _RunAndStayResident {
// TODO(devoncarew): This fails for ios devices - we haven't built yet.
if
(
device
is
AndroidDevice
)
{
printTrace
(
'Running install command.'
);
if
(!(
await
installApp
(
device
,
package
)))
if
(!(
installApp
(
device
,
package
)))
return
1
;
}
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
94636bd2
...
...
@@ -78,7 +78,7 @@ class SimControl {
bool
connected
=
false
;
int
attempted
=
0
;
while
(!
connected
&&
attempted
<
20
)
{
connected
=
await
_isAnyConnected
();
connected
=
_isAnyConnected
();
if
(!
connected
)
{
printStatus
(
'Still waiting for iOS Simulator to boot...'
);
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
seconds:
1
));
...
...
packages/flx/test/bundle_test.dart
View file @
94636bd2
...
...
@@ -24,7 +24,7 @@ Future<Null> main() async {
final
Uint8List
kTestBytes
=
new
Uint8List
.
fromList
(<
int
>[
1
,
2
,
3
]);
// Create a temp dir and file for the bundle.
Directory
tempDir
=
await
Directory
.
systemTemp
.
createTempSync
(
'bundle_test'
);
Directory
tempDir
=
Directory
.
systemTemp
.
createTempSync
(
'bundle_test'
);
String
bundlePath
=
tempDir
.
path
+
'/bundle.flx'
;
AsymmetricKeyPair
<
PublicKey
,
PrivateKey
>
keyPair
=
keyPairFromPrivateKeyBytes
(
kPrivateKeyDER
);
...
...
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