add GeneralInfo project validator to analyze --suggestions (#109874)
This commit is contained in:
@@ -143,7 +143,7 @@ List<FlutterCommand> generateCommands({
|
||||
terminal: globals.terminal,
|
||||
artifacts: globals.artifacts!,
|
||||
// new ProjectValidators should be added here for the --suggestions to run
|
||||
allProjectValidators: <ProjectValidator>[],
|
||||
allProjectValidators: <ProjectValidator>[GeneralInfoProjectValidator()],
|
||||
),
|
||||
AssembleCommand(verboseHelp: verboseHelp, buildSystem: globals.buildSystem),
|
||||
AttachCommand(verboseHelp: verboseHelp),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:process/process.dart';
|
||||
|
||||
import '../artifacts.dart';
|
||||
@@ -112,6 +113,9 @@ class AnalyzeCommand extends FlutterCommand {
|
||||
@override
|
||||
String get category => FlutterCommandCategory.project;
|
||||
|
||||
@visibleForTesting
|
||||
List<ProjectValidator> allProjectValidators() => _allProjectValidators;
|
||||
|
||||
@override
|
||||
bool get shouldRunPub {
|
||||
// If they're not analyzing the current project.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import 'package:args/args.dart';
|
||||
import 'package:args/command_runner.dart';
|
||||
import 'package:flutter_tools/executable.dart' as executable;
|
||||
import 'package:flutter_tools/src/commands/analyze.dart';
|
||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||
import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
|
||||
|
||||
@@ -23,6 +24,12 @@ void main() {
|
||||
verbose: true,
|
||||
).forEach(runner.addCommand);
|
||||
verifyCommandRunner(runner);
|
||||
for (final Command<void> command in runner.commands.values) {
|
||||
if(command.name == 'analyze') {
|
||||
final AnalyzeCommand analyze = command as AnalyzeCommand;
|
||||
expect(analyze.allProjectValidators().length, 1);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
testUsingContext('bool? safe argResults', () async {
|
||||
|
||||
Reference in New Issue
Block a user