Skip to content

Commit f53388b

Browse files
devoncarewcommit-bot@chromium.org
authored andcommitted
[analyzer] enable implicit-casts: false for several projects
Change-Id: Idd7ed77756d93a94f637dcc4abd7e0403a2f6d81 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112703 Commit-Queue: Devon Carew <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 20407e2 commit f53388b

File tree

9 files changed

+42
-7
lines changed

9 files changed

+42
-7
lines changed

pkg/analysis_server/analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
analyzer:
2+
# This currently finds ~1,200 implicit-casts issues when enabled.
3+
# strong-mode:
4+
# implicit-casts: false
25
exclude:
36
- test/mock_packages/**
47

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
analyzer:
2+
#strong-mode:
3+
# implicit-casts: false
4+
5+
linter:
6+
rules:
7+
- empty_constructor_bodies
8+
- empty_statements
9+
- unnecessary_brace_in_string_interps
10+
- valid_regexps

pkg/analysis_server_client/example/example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class _Handler with NotificationHandler, ConnectionHandler {
9999
if (errorCount == 0) {
100100
print('No issues found.');
101101
} else {
102-
print('Found ${errorCount} errors/warnings/hints');
102+
print('Found $errorCount errors/warnings/hints');
103103
}
104104
errorCount = 0;
105105
print('--------- ctrl-c to exit ---------');

pkg/analysis_server_client/lib/src/protocol/protocol_util.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ class JenkinsSmiHash {
3232
}
3333

3434
/// Combines together two hash codes.
35-
static int hash2(a, b) => finish(combine(combine(0, a), b));
35+
static int hash2(int a, int b) => finish(combine(combine(0, a), b));
3636

3737
/// Combines together three hash codes.
38-
static int hash3(a, b, c) => finish(combine(combine(combine(0, a), b), c));
38+
static int hash3(int a, int b, int c) =>
39+
finish(combine(combine(combine(0, a), b), c));
3940

4041
/// Combines together four hash codes.
41-
static int hash4(a, b, c, d) =>
42+
static int hash4(int a, int b, int c, int d) =>
4243
finish(combine(combine(combine(combine(0, a), b), c), d));
4344

4445
int _hash = 0;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
analyzer:
2+
strong-mode:
3+
implicit-casts: false
4+
5+
linter:
6+
rules:
7+
- empty_constructor_bodies
8+
- empty_statements
9+
- unnecessary_brace_in_string_interps
10+
- valid_regexps

pkg/analyzer/analysis_options.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
analyzer:
2+
# This currently finds ~4,500 implicit-casts issues when enabled.
3+
# strong-mode:
4+
# implicit-casts: false
5+
16
linter:
27
rules:
38
- empty_constructor_bodies # pedantic

pkg/analyzer/lib/src/dart/element/wrapped.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ class WrappedCompilationUnitElement implements CompilationUnitElement {
194194
.accept(visitor); // ignore: deprecated_member_use_from_same_package
195195

196196
@override
197-
String computeDocumentationComment() =>
198-
wrappedUnit.computeDocumentationComment();
197+
String computeDocumentationComment() {
198+
// ignore: deprecated_member_use_from_same_package
199+
return wrappedUnit.computeDocumentationComment();
200+
}
199201

200202
@deprecated
201203
@override

pkg/dartfix/analysis_options.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
include: package:pedantic/analysis_options.1.8.0.yaml
22

3+
analyzer:
4+
strong-mode:
5+
implicit-casts: false
6+
37
linter:
48
rules:
59
directives_ordering: true

pkg/dartfix/lib/src/options.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Options {
5252
pedanticFixes = results[pedanticOption] as bool,
5353
requiredFixes = results[requiredOption] as bool,
5454
sdkPath = _getSdkPath(),
55-
serverSnapshot = results[_serverSnapshot],
55+
serverSnapshot = results[_serverSnapshot] as String,
5656
showHelp = results[_helpOption] as bool || results.arguments.isEmpty,
5757
targets = results.rest,
5858
useColor = results.wasParsed(_colorOption)

0 commit comments

Comments
 (0)