[pkg/dartdev] switch to using package:lints for analysis

Change-Id: I7bd4843968e2f2d1454e1a79605ffc777c555ebe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202721
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Devon Carew
2021-06-07 18:36:43 +00:00
committed by commit-bot@chromium.org
parent ccdda71dd7
commit 48ef892281
14 changed files with 32 additions and 41 deletions
+8 -20
View File
@@ -1,23 +1,11 @@
include: package:pedantic/analysis_options.1.9.0.yaml
analyzer:
errors:
# Increase the severity of several hints.
prefer_single_quotes: warning
unused_import: warning
unnecessary_brace_in_string_interps: warning
# Ignore one pedantic lint
omit_local_variable_types: ignore
include: package:lints/recommended.yaml
linter:
rules:
- always_declare_return_types
- depend_on_referenced_packages
- directives_ordering
- overridden_fields
- prefer_single_quotes
- sort_pub_dependencies
- unnecessary_brace_in_string_interps
- unnecessary_overrides
- unnecessary_parenthesis
# Disable implementation_imports.
implementation_imports: false
# Enable additional rules.
depend_on_referenced_packages: true
directives_ordering: true
sort_pub_dependencies: true
+3 -3
View File
@@ -34,14 +34,14 @@ void main(List<String> args) async {
}
if (!argResults.wasParsed('dart-sdk')) {
print('No value passed for \`dart-sdk\`.');
print('No value passed for `dart-sdk`.');
print('');
printUsage(argParser);
io.exit(1);
}
if (!argResults.wasParsed('run')) {
print('No value passed for \`run\`.');
print('No value passed for `run`.');
print('');
printUsage(argParser);
io.exit(1);
@@ -143,7 +143,7 @@ class DartRunStartup extends Benchmark {
: super(
'run-script-startup',
'Benchmark the startup time of a minimal Dart script, executed with '
'\`dart run\` (μs).',
'`dart run` (μs).',
);
@override
+4 -1
View File
@@ -231,6 +231,7 @@ class DartdevRunner extends CommandRunner<int> {
exitCode = 1;
} finally {
stopwatch.stop();
if (analytics.enabled) {
unawaited(
analytics.sendTiming(
@@ -240,6 +241,7 @@ class DartdevRunner extends CommandRunner<int> {
),
);
}
// Set the exitCode, if it wasn't set in the catch block above.
exitCode ??= 0;
@@ -265,7 +267,8 @@ class DartdevRunner extends CommandRunner<int> {
analytics.enabled = true;
}
analytics.close();
return exitCode;
}
return exitCode;
}
}
+1 -1
View File
@@ -207,7 +207,7 @@ class AnalyzeCommand extends DartdevCommand {
}
// Emit "file:line:col * Error message. Correction (code)."
var message = ansi.emphasized('${error.message}');
var message = ansi.emphasized(error.message);
if (error.correction != null) {
message += ' ${error.correction}';
}
+4 -4
View File
@@ -128,12 +128,12 @@ To use the tool, run either ['dart fix --dry-run'] for a preview of the proposed
var fileCount = 0;
var fixCount = 0;
details.forEach((d) {
for (var d in details) {
++fileCount;
d.fixes.forEach((f) {
for (var f in d.fixes) {
fixCount += f.occurrences;
});
});
}
}
if (dryRun) {
log.stdout('');
+3 -4
View File
@@ -110,10 +110,9 @@ class RunCommand extends DartdevCommand {
);
if (verbose) {
argParser
..addSeparator(
'Advanced options:',
);
argParser.addSeparator(
'Advanced options:',
);
}
argParser
..addMultiOption(
+1 -1
View File
@@ -64,7 +64,7 @@ Future<void> sendUsageEvent(
specifiedExperiments = specifiedExperiments?.toList() ?? [];
// Sort the flag lists to slightly reduce the explosion of possibilities.
commandFlags..sort();
commandFlags.sort();
specifiedExperiments.sort();
// Insert a seperator before and after the flags list to make it easier to filter
@@ -26,7 +26,7 @@ class ConsoleFullGenerator extends DefaultGenerator {
@override
String getInstallInstructions(
String directory,
String scriptName,
String scriptPath,
) =>
super.getInstallInstructions(directory, null);
}
@@ -24,7 +24,7 @@ class ConsoleSimpleGenerator extends DefaultGenerator {
@override
String getInstallInstructions(
String directory,
String scriptName,
String scriptPath,
) =>
super.getInstallInstructions(directory, null);
}
@@ -27,11 +27,11 @@ class PackageSimpleGenerator extends DefaultGenerator {
@override
String getInstallInstructions(
String directory,
String projectName,
String scriptPath,
) =>
super.getInstallInstructions(
directory,
'example/${projectName}_example',
'example/${scriptPath}_example',
);
}
@@ -27,7 +27,7 @@ class ServerShelfGenerator extends DefaultGenerator {
@override
String getInstallInstructions(
String directory,
String scriptName,
String scriptPath,
) =>
super.getInstallInstructions(
directory,
@@ -28,7 +28,7 @@ class WebSimpleGenerator extends DefaultGenerator {
@override
String getInstallInstructions(
String directory,
String scriptName,
String scriptPath,
) =>
' cd ${p.relative(directory)}\n'
' dart pub global activate webdev\n'
+1
View File
@@ -32,6 +32,7 @@ dependencies:
usage: ^3.4.0
dev_dependencies:
lints: any
pub_semver: any
test: ^1.0.0
yaml: any
+1 -1
View File
@@ -141,7 +141,7 @@ void defineCreateTests() {
// Create tests for each template.
for (String templateId in CreateCommand.legalTemplateIds) {
test('$templateId', () {
test(templateId, () {
p = project();
const projectName = 'template_project';
ProcessResult result = p.runSync([