argParser.addFlag('flutter-repo',help:'Include all the examples and tests from the Flutter repository.',defaultsTo:false);
argParser.addFlag('current-directory',help:'Include all the Dart files in the current directory, if any.',defaultsTo:true);
argParser.addFlag('current-package',help:'Include the lib/main.dart file from the current directory, if any.',defaultsTo:true);
argParser.addFlag('dartdocs',help:'List every public member that is lacking documentation (only examines files in the Flutter repository).',defaultsTo:false);
argParser.addOption('write',valueHelp:'file',help:'Also output the results to a file.');
argParser.addOption('dart-sdk',valueHelp:'path-to-sdk',help:'The path to the Dart SDK.',hide:!verboseHelp);
// Hidden option to enable a benchmarking mode.
argParser.addFlag('benchmark',negatable:false,hide:!verboseHelp,help:'Also output the analysis time');
usesPubOption();
}
@override
/// Common behavior for `flutter analyze` and `flutter analyze --watch`
boolgetshouldRunPub{
abstractclassAnalyzeBase{
// If they're not analyzing the current project.
/// The parsed argument results for execution.
if(!argResults['current-package'])
finalArgResultsargResults;
returnfalse;
// Or we're not in a project directory.
AnalyzeBase(this.argResults);
if(!newFile('pubspec.yaml').existsSync())
returnfalse;
returnsuper.shouldRunPub;
/// Called by [AnalyzeCommand] to start the analysis process.
}
Future<int>analyze();
voiddumpErrors(Iterable<String>errors){
voiddumpErrors(Iterable<String>errors){
if(argResults['write']!=null){
if(argResults['write']!=null){
...
@@ -65,4 +50,19 @@ abstract class AnalysisCommand extends FlutterCommand {
...
@@ -65,4 +50,19 @@ abstract class AnalysisCommand extends FlutterCommand {
}
}
boolgetisBenchmarking=>argResults['benchmark'];
boolgetisBenchmarking=>argResults['benchmark'];
}
/// Return `true` if [fileList] contains a path that resides inside the Flutter repository.
/// If [fileList] is empty, then return `true` if the current directory resides inside the Flutter repository.