[dartdev] address a few analysis issues
Change-Id: I546a88aeed31a3e7349a45825087e3bed4720559 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138913 Reviewed-by: Jaime Wren <jwren@google.com> Commit-Queue: Devon Carew <devoncarew@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
699f4b7395
commit
41cb842cb2
@@ -1 +1,14 @@
|
||||
include: package:pedantic/analysis_options.1.8.0.yaml
|
||||
|
||||
analyzer:
|
||||
errors:
|
||||
# Increase the severity of several hints.
|
||||
prefer_single_quotes: warning
|
||||
unused_import: warning
|
||||
unnecessary_brace_in_string_interps: warning
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- directives_ordering
|
||||
- prefer_single_quotes
|
||||
- unnecessary_brace_in_string_interps
|
||||
|
||||
@@ -32,7 +32,7 @@ class AnalyzeCommand extends DartdevCommand<int> {
|
||||
@override
|
||||
FutureOr<int> run() async {
|
||||
if (argResults.rest.length > 1) {
|
||||
usageException("Only one directory is expected.");
|
||||
usageException('Only one directory is expected.');
|
||||
}
|
||||
|
||||
// find directory from argResults.rest
|
||||
|
||||
@@ -87,10 +87,10 @@ void defineAnalyze() {
|
||||
|
||||
expect(result.exitCode, 3);
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.stdout, contains("A value of type "));
|
||||
expect(result.stdout, contains("lib/main.dart:1:16 "));
|
||||
expect(result.stdout, contains("return_of_invalid_type"));
|
||||
expect(result.stdout, contains("1 issue found."));
|
||||
expect(result.stdout, contains('A value of type '));
|
||||
expect(result.stdout, contains('lib/main.dart:1:16 '));
|
||||
expect(result.stdout, contains('return_of_invalid_type'));
|
||||
expect(result.stdout, contains('1 issue found.'));
|
||||
});
|
||||
|
||||
test('two errors', () {
|
||||
@@ -99,7 +99,7 @@ void defineAnalyze() {
|
||||
|
||||
expect(result.exitCode, 3);
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.stdout, contains("2 issues found."));
|
||||
expect(result.stdout, contains('2 issues found.'));
|
||||
});
|
||||
|
||||
test('warning --fatal-warnings', () {
|
||||
@@ -110,7 +110,7 @@ void defineAnalyze() {
|
||||
// should be exitCode == 2, not greater than 0:
|
||||
expect(result.exitCode, greaterThan(0));
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.stdout, contains("1 issue found."));
|
||||
expect(result.stdout, contains('1 issue found.'));
|
||||
});
|
||||
|
||||
test('warning implicit --fatal-warnings', () {
|
||||
@@ -121,7 +121,7 @@ void defineAnalyze() {
|
||||
// should be exitCode == 2, not greater than 0:
|
||||
expect(result.exitCode, greaterThan(0));
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.stdout, contains("1 issue found."));
|
||||
expect(result.stdout, contains('1 issue found.'));
|
||||
});
|
||||
|
||||
test('warning --no-fatal-warnings', () {
|
||||
@@ -132,24 +132,24 @@ void defineAnalyze() {
|
||||
// should be exitCode == 0:
|
||||
// expect(result.exitCode, 0);
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.stdout, contains("1 issue found."));
|
||||
expect(result.stdout, contains('1 issue found.'));
|
||||
});
|
||||
|
||||
test('info implicit no --fatal-infos', () {
|
||||
p = project(mainSrc: "String foo() {}");
|
||||
p = project(mainSrc: 'String foo() {}');
|
||||
var result = p.runSync('analyze', [p.dirPath]);
|
||||
|
||||
expect(result.exitCode, 0);
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.stdout, contains("1 issue found."));
|
||||
expect(result.stdout, contains('1 issue found.'));
|
||||
});
|
||||
|
||||
test('info --fatal-infos', () {
|
||||
p = project(mainSrc: "String foo() {}");
|
||||
p = project(mainSrc: 'String foo() {}');
|
||||
var result = p.runSync('analyze', ['--fatal-infos', p.dirPath]);
|
||||
|
||||
expect(result.exitCode, 1);
|
||||
expect(result.stderr, isEmpty);
|
||||
expect(result.stdout, contains("1 issue found."));
|
||||
expect(result.stdout, contains('1 issue found.'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ void format() {
|
||||
ProcessResult result = p.runSync('format', [unknownFilePath]);
|
||||
expect(result.exitCode, 0);
|
||||
expect(result.stderr,
|
||||
startsWith('No file or directory found at "${unknownFilePath}".'));
|
||||
startsWith('No file or directory found at "$unknownFilePath".'));
|
||||
expect(result.stdout, isEmpty);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user