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
700dc9f7
Commit
700dc9f7
authored
Oct 19, 2017
by
Alexandre Ardhuin
Committed by
GitHub
Oct 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable lint avoid_function_literals_in_foreach_calls (#12607)
parent
79fbf8bb
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
52 additions
and
51 deletions
+52
-51
analysis_options.yaml
analysis_options.yaml
+1
-1
analysis_options_repo.yaml
analysis_options_repo.yaml
+1
-1
save_catalog_screenshots.dart
dev/devicelab/lib/tasks/save_catalog_screenshots.dart
+2
-2
sample_page.dart
examples/catalog/bin/sample_page.dart
+2
-2
routes_test.dart
packages/flutter/test/widgets/routes_test.dart
+2
-1
date_picker_test.dart
packages/flutter_localizations/test/date_picker_test.dart
+4
-4
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+3
-3
file_system.dart
packages/flutter_tools/lib/src/base/file_system.dart
+2
-2
analyze_base.dart
packages/flutter_tools/lib/src/commands/analyze_base.dart
+14
-14
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+2
-1
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+2
-1
forbidden_imports_test.dart
packages/flutter_tools/test/forbidden_imports_test.dart
+17
-19
No files found.
analysis_options.yaml
View file @
700dc9f7
...
...
@@ -80,7 +80,7 @@ linter:
# - avoid_catches_without_on_clauses # not yet tested
# - avoid_catching_errors # not yet tested
# - avoid_classes_with_only_static_members # not yet tested
# - avoid_function_literals_in_foreach_calls # not yet tested
-
avoid_function_literals_in_foreach_calls
-
avoid_init_to_null
-
avoid_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # not yet tested
...
...
analysis_options_repo.yaml
View file @
700dc9f7
...
...
@@ -74,7 +74,7 @@ linter:
# - avoid_catches_without_on_clauses # not yet tested
# - avoid_catching_errors # not yet tested
# - avoid_classes_with_only_static_members # not yet tested
# - avoid_function_literals_in_foreach_calls # not yet tested
-
avoid_function_literals_in_foreach_calls
-
avoid_init_to_null
-
avoid_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # not yet tested
...
...
dev/devicelab/lib/tasks/save_catalog_screenshots.dart
View file @
700dc9f7
...
...
@@ -120,12 +120,12 @@ Future<Null> saveCatalogScreenshots({
String
prefix
,
// Prefix for all file names.
})
async
{
final
List
<
String
>
screenshots
=
<
String
>[];
directory
.
listSync
().
forEach
((
FileSystemEntity
entity
)
{
for
(
FileSystemEntity
entity
in
directory
.
listSync
()
)
{
if
(
entity
is
File
&&
entity
.
path
.
endsWith
(
'.png'
))
{
final
File
file
=
entity
;
screenshots
.
add
(
file
.
path
);
}
}
);
}
final
List
<
String
>
largeNames
=
<
String
>[];
// Cloud storage names for the full res screenshots.
final
List
<
String
>
smallNames
=
<
String
>[];
// Likewise for the scaled down screenshots.
...
...
examples/catalog/bin/sample_page.dart
View file @
700dc9f7
...
...
@@ -146,13 +146,13 @@ void generate(String commit) {
initialize
();
final
List
<
SampleInfo
>
samples
=
<
SampleInfo
>[];
sampleDirectory
.
listSync
().
forEach
((
FileSystemEntity
entity
)
{
for
(
FileSystemEntity
entity
in
sampleDirectory
.
listSync
()
)
{
if
(
entity
is
File
&&
entity
.
path
.
endsWith
(
'.dart'
))
{
final
SampleInfo
sample
=
new
SampleInfo
(
entity
,
commit
);
if
(
sample
.
initialize
())
// skip files that lack the Sample Catalog comment
samples
.
add
(
sample
);
}
}
);
}
// Causes the generated imports to appear in alphabetical order.
// Avoid complaints from flutter lint.
...
...
packages/flutter/test/widgets/routes_test.dart
View file @
700dc9f7
...
...
@@ -74,7 +74,8 @@ class TestRoute extends LocalHistoryRoute<String> {
@override
void
dispose
()
{
log
(
'dispose'
);
_entries
.
forEach
((
OverlayEntry
entry
)
{
entry
.
remove
();
});
for
(
OverlayEntry
entry
in
_entries
)
entry
.
remove
();
_entries
.
clear
();
routes
.
remove
(
this
);
super
.
dispose
();
...
...
packages/flutter_localizations/test/date_picker_test.dart
View file @
700dc9f7
...
...
@@ -64,12 +64,12 @@ void main() {
expect
(
find
.
text
(
expectedMonthYearHeader
),
findsOneWidget
);
expectedDaysOfWeek
.
forEach
((
String
day
OfWeek
)
{
for
(
String
dayOfWeek
in
expectedDays
OfWeek
)
{
expect
(
find
.
text
(
dayOfWeek
),
findsWidgets
);
}
);
}
Offset
previousCellOffset
;
expectedDaysOfMonth
.
forEach
((
String
day
OfMonth
)
{
for
(
String
dayOfMonth
in
expectedDays
OfMonth
)
{
final
Finder
dayCell
=
find
.
descendant
(
of:
find
.
byType
(
GridView
),
matching:
find
.
text
(
dayOfMonth
));
expect
(
dayCell
,
findsOneWidget
);
...
...
@@ -84,7 +84,7 @@ void main() {
}
}
previousCellOffset
=
offset
;
}
);
}
});
}
});
...
...
packages/flutter_tools/lib/src/android/gradle.dart
View file @
700dc9f7
...
...
@@ -100,7 +100,7 @@ Future<GradleProject> _readGradleProject() async {
if
(
flutterPluginVersion
==
FlutterPluginVersion
.
managed
)
{
// Handle known exceptions. This will exit if handled.
handleKnownGradleExceptions
(
e
);
// Print a general Gradle error and exit.
printError
(
'* Error running Gradle:
\n
$e
\n
'
);
throwToolExit
(
'Please review your Gradle project setup in the android/ folder.'
);
...
...
@@ -355,14 +355,14 @@ class GradleProject {
// Extract build types and product flavors.
final
Set
<
String
>
variants
=
new
Set
<
String
>();
properties
.
split
(
'
\n
'
).
forEach
((
String
s
)
{
for
(
String
s
in
properties
.
split
(
'
\n
'
)
)
{
final
Match
match
=
_assembleTaskPattern
.
matchAsPrefix
(
s
);
if
(
match
!=
null
)
{
final
String
variant
=
match
.
group
(
1
).
toLowerCase
();
if
(!
variant
.
endsWith
(
'test'
))
variants
.
add
(
variant
);
}
}
);
}
final
Set
<
String
>
buildTypes
=
new
Set
<
String
>();
final
Set
<
String
>
productFlavors
=
new
Set
<
String
>();
for
(
final
String
variant1
in
variants
)
{
...
...
packages/flutter_tools/lib/src/base/file_system.dart
View file @
700dc9f7
...
...
@@ -82,7 +82,7 @@ void copyDirectorySync(Directory srcDir, Directory destDir, [void onFileCopied(F
if
(!
destDir
.
existsSync
())
destDir
.
createSync
(
recursive:
true
);
srcDir
.
listSync
().
forEach
((
FileSystemEntity
entity
)
{
for
(
FileSystemEntity
entity
in
srcDir
.
listSync
()
)
{
final
String
newPath
=
destDir
.
fileSystem
.
path
.
join
(
destDir
.
path
,
entity
.
basename
);
if
(
entity
is
File
)
{
final
File
newFile
=
destDir
.
fileSystem
.
file
(
newPath
);
...
...
@@ -94,7 +94,7 @@ void copyDirectorySync(Directory srcDir, Directory destDir, [void onFileCopied(F
}
else
{
throw
new
Exception
(
'
${entity.path}
is neither File nor Directory'
);
}
}
);
}
}
/// Gets a directory to act as a recording destination, creating the directory
...
...
packages/flutter_tools/lib/src/commands/analyze_base.dart
View file @
700dc9f7
...
...
@@ -132,22 +132,22 @@ class PackageDependencyTracker {
final
File
dotPackages
=
fs
.
file
(
dotPackagesPath
);
if
(
dotPackages
.
existsSync
())
{
// this directory has opinions about what we should be using
dotPackages
final
Iterable
<
String
>
lines
=
dotPackages
.
readAsStringSync
()
.
split
(
'
\n
'
)
.
where
((
String
line
)
=>
!
line
.
startsWith
(
new
RegExp
(
r'^ *#'
)))
.
forEach
((
String
line
)
{
final
int
colon
=
line
.
indexOf
(
':'
);
if
(
colon
>
0
)
{
final
String
packageName
=
line
.
substring
(
0
,
colon
);
final
String
packagePath
=
fs
.
path
.
fromUri
(
line
.
substring
(
colon
+
1
));
// Ensure that we only add `analyzer` and dependent packages defined in the vended SDK (and referred to with a local
// fs.path. directive). Analyzer package versions reached via transitive dependencies (e.g., via `test`) are ignored
// since they would produce spurious conflicts.
if
(!
_vendedSdkPackages
.
contains
(
packageName
)
||
packagePath
.
startsWith
(
'..'
))
add
(
packageName
,
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
directory
.
path
,
packagePath
)),
dotPackagesPath
);
}
}
);
.
where
((
String
line
)
=>
!
line
.
startsWith
(
new
RegExp
(
r'^ *#'
)))
;
for
(
String
line
in
lines
)
{
final
int
colon
=
line
.
indexOf
(
':'
);
if
(
colon
>
0
)
{
final
String
packageName
=
line
.
substring
(
0
,
colon
);
final
String
packagePath
=
fs
.
path
.
fromUri
(
line
.
substring
(
colon
+
1
));
// Ensure that we only add `analyzer` and dependent packages defined in the vended SDK (and referred to with a local
// fs.path. directive). Analyzer package versions reached via transitive dependencies (e.g., via `test`) are ignored
// since they would produce spurious conflicts.
if
(!
_vendedSdkPackages
.
contains
(
packageName
)
||
packagePath
.
startsWith
(
'..'
))
add
(
packageName
,
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
directory
.
path
,
packagePath
)),
dotPackagesPath
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
700dc9f7
...
...
@@ -143,7 +143,8 @@ class Daemon {
void
shutdown
({
dynamic
error
})
{
_commandSubscription
?.
cancel
();
_domainMap
.
values
.
forEach
((
Domain
domain
)
=>
domain
.
dispose
());
for
(
Domain
domain
in
_domainMap
.
values
)
domain
.
dispose
();
if
(!
_onExitCompleter
.
isCompleted
)
{
if
(
error
==
null
)
_onExitCompleter
.
complete
(
0
);
...
...
packages/flutter_tools/lib/src/vmservice.dart
View file @
700dc9f7
...
...
@@ -636,7 +636,8 @@ class VM extends ServiceObjectOwner {
void
_removeDeadIsolates
(
List
<
Isolate
>
newIsolates
)
{
// Build a set of new isolates.
final
Set
<
String
>
newIsolateSet
=
new
Set
<
String
>();
newIsolates
.
forEach
((
Isolate
iso
)
=>
newIsolateSet
.
add
(
iso
.
id
));
for
(
Isolate
iso
in
newIsolates
)
newIsolateSet
.
add
(
iso
.
id
);
// Remove any old isolates which no longer exist.
final
List
<
String
>
toRemove
=
<
String
>[];
...
...
packages/flutter_tools/test/forbidden_imports_test.dart
View file @
700dc9f7
...
...
@@ -15,39 +15,37 @@ void main() {
bool
_isNotWhitelisted
(
FileSystemEntity
entity
)
=>
entity
.
path
!=
whitelistedPath
;
for
(
String
dirName
in
<
String
>[
'lib'
,
'bin'
])
{
fs
.
directory
(
fs
.
path
.
join
(
flutterTools
,
dirName
))
f
inal
Iterable
<
File
>
files
=
f
s
.
directory
(
fs
.
path
.
join
(
flutterTools
,
dirName
))
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
where
(
_isNotWhitelisted
)
.
map
(
_asFile
)
.
forEach
((
File
file
)
{
for
(
String
line
in
file
.
readAsLinesSync
())
{
if
(
line
.
startsWith
(
new
RegExp
(
r'import.*dart:io'
))
&&
!
line
.
contains
(
'ignore: dart_io_import'
))
{
final
String
relativePath
=
fs
.
path
.
relative
(
file
.
path
,
from:
flutterTools
);
fail
(
"
$relativePath
imports 'dart:io'; import 'lib/src/base/io.dart' instead"
);
}
.
map
(
_asFile
);
for
(
File
file
in
files
)
{
for
(
String
line
in
file
.
readAsLinesSync
())
{
if
(
line
.
startsWith
(
new
RegExp
(
r'import.*dart:io'
))
&&
!
line
.
contains
(
'ignore: dart_io_import'
))
{
final
String
relativePath
=
fs
.
path
.
relative
(
file
.
path
,
from:
flutterTools
);
fail
(
"
$relativePath
imports 'dart:io'; import 'lib/src/base/io.dart' instead"
);
}
}
);
}
}
});
test
(
'no unauthorized imports of package:path'
,
()
{
for
(
String
dirName
in
<
String
>[
'lib'
,
'bin'
,
'test'
])
{
fs
.
directory
(
fs
.
path
.
join
(
flutterTools
,
dirName
))
f
inal
Iterable
<
File
>
files
=
f
s
.
directory
(
fs
.
path
.
join
(
flutterTools
,
dirName
))
.
listSync
(
recursive:
true
)
.
where
(
_isDartFile
)
.
map
(
_asFile
)
.
forEach
((
File
file
)
{
for
(
String
line
in
file
.
readAsLinesSync
())
{
if
(
line
.
startsWith
(
new
RegExp
(
r'import.*package:path/path.dart'
)))
{
final
String
relativePath
=
fs
.
path
.
relative
(
file
.
path
,
from:
flutterTools
);
fail
(
"
$relativePath
imports 'package:path/path.dart'; use 'fs.path' instead"
);
}
.
map
(
_asFile
);
for
(
File
file
in
files
)
{
for
(
String
line
in
file
.
readAsLinesSync
())
{
if
(
line
.
startsWith
(
new
RegExp
(
r'import.*package:path/path.dart'
)))
{
final
String
relativePath
=
fs
.
path
.
relative
(
file
.
path
,
from:
flutterTools
);
fail
(
"
$relativePath
imports 'package:path/path.dart'; use 'fs.path' instead"
);
}
}
);
}
}
});
}
...
...
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