mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
fix flutter analyze --dartdocs (#10182)
This commit is contained in:
parent
cd6e3b1ac2
commit
77d67c9d30
@ -116,7 +116,7 @@ linter:
|
|||||||
# - prefer_interpolation_to_compose_strings # not yet tested
|
# - prefer_interpolation_to_compose_strings # not yet tested
|
||||||
- prefer_is_empty
|
- prefer_is_empty
|
||||||
- prefer_is_not_empty
|
- prefer_is_not_empty
|
||||||
# - public_member_api_docs # this is the only difference from .analysis_options_repo
|
- public_member_api_docs # this is the only difference from .analysis_options_repo
|
||||||
# - recursive_getters # https://github.com/dart-lang/linter/issues/452
|
# - recursive_getters # https://github.com/dart-lang/linter/issues/452
|
||||||
- slash_for_doc_comments
|
- slash_for_doc_comments
|
||||||
- sort_constructors_first
|
- sort_constructors_first
|
||||||
|
@ -148,7 +148,6 @@ class BufferLogger extends Logger {
|
|||||||
_error.writeln(message);
|
_error.writeln(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void printStatus(
|
void printStatus(
|
||||||
String message,
|
String message,
|
||||||
|
@ -17,7 +17,7 @@ class AnalyzeCommand extends FlutterCommand {
|
|||||||
AnalyzeCommand({ bool verboseHelp: false, this.workingDirectory }) {
|
AnalyzeCommand({ bool verboseHelp: false, this.workingDirectory }) {
|
||||||
argParser.addFlag('flutter-repo', help: 'Include all the examples and tests from the Flutter repository.', defaultsTo: false);
|
argParser.addFlag('flutter-repo', help: 'Include all the examples and tests from the Flutter repository.', defaultsTo: false);
|
||||||
argParser.addFlag('current-package', help: 'Include the lib/main.dart file from 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.addFlag('dartdocs', help: 'List every public member that is lacking documentation (only works with --flutter-repo and without --watch).', defaultsTo: false, hide: !verboseHelp);
|
||||||
argParser.addFlag('watch', help: 'Run analysis continuously, watching the filesystem for changes.', negatable: false);
|
argParser.addFlag('watch', help: 'Run analysis continuously, watching the filesystem for changes.', negatable: false);
|
||||||
argParser.addOption('write', valueHelp: 'file', help: 'Also output the results to a file. This is useful with --watch if you want a file to always contain the latest results.');
|
argParser.addOption('write', valueHelp: 'file', help: 'Also output the results to a file. This is useful with --watch if you want a file to always contain the latest results.');
|
||||||
argParser.addOption('dart-sdk', valueHelp: 'path-to-sdk', help: 'The path to the Dart SDK.', hide: !verboseHelp);
|
argParser.addOption('dart-sdk', valueHelp: 'path-to-sdk', help: 'The path to the Dart SDK.', hide: !verboseHelp);
|
||||||
|
@ -20,10 +20,10 @@ import '../globals.dart';
|
|||||||
import 'analyze_base.dart';
|
import 'analyze_base.dart';
|
||||||
|
|
||||||
class AnalyzeContinuously extends AnalyzeBase {
|
class AnalyzeContinuously extends AnalyzeBase {
|
||||||
final List<Directory> repoAnalysisEntryPoints;
|
|
||||||
|
|
||||||
AnalyzeContinuously(ArgResults argResults, this.repoAnalysisEntryPoints) : super(argResults);
|
AnalyzeContinuously(ArgResults argResults, this.repoAnalysisEntryPoints) : super(argResults);
|
||||||
|
|
||||||
|
final List<Directory> repoAnalysisEntryPoints;
|
||||||
|
|
||||||
String analysisTarget;
|
String analysisTarget;
|
||||||
bool firstAnalysis = true;
|
bool firstAnalysis = true;
|
||||||
Set<String> analyzedPaths = new Set<String>();
|
Set<String> analyzedPaths = new Set<String>();
|
||||||
@ -36,6 +36,9 @@ class AnalyzeContinuously extends AnalyzeBase {
|
|||||||
Future<Null> analyze() async {
|
Future<Null> analyze() async {
|
||||||
List<String> directories;
|
List<String> directories;
|
||||||
|
|
||||||
|
if (argResults['dartdocs'])
|
||||||
|
throwToolExit('The --dartdocs option is currently not supported when using --watch.');
|
||||||
|
|
||||||
if (argResults['flutter-repo']) {
|
if (argResults['flutter-repo']) {
|
||||||
directories = repoAnalysisEntryPoints.map((Directory dir) => dir.path).toList();
|
directories = repoAnalysisEntryPoints.map((Directory dir) => dir.path).toList();
|
||||||
analysisTarget = 'Flutter repository';
|
analysisTarget = 'Flutter repository';
|
||||||
|
@ -36,7 +36,6 @@ class AnalyzeOnce extends AnalyzeBase {
|
|||||||
final Stopwatch stopwatch = new Stopwatch()..start();
|
final Stopwatch stopwatch = new Stopwatch()..start();
|
||||||
final Set<Directory> pubSpecDirectories = new HashSet<Directory>();
|
final Set<Directory> pubSpecDirectories = new HashSet<Directory>();
|
||||||
final List<File> dartFiles = <File>[];
|
final List<File> dartFiles = <File>[];
|
||||||
|
|
||||||
for (String file in argResults.rest.toList()) {
|
for (String file in argResults.rest.toList()) {
|
||||||
file = fs.path.normalize(fs.path.absolute(file));
|
file = fs.path.normalize(fs.path.absolute(file));
|
||||||
final String root = fs.path.rootPrefix(file);
|
final String root = fs.path.rootPrefix(file);
|
||||||
@ -58,6 +57,9 @@ class AnalyzeOnce extends AnalyzeBase {
|
|||||||
// currently supports (e.g. missing member dartdoc summary).
|
// currently supports (e.g. missing member dartdoc summary).
|
||||||
// TODO(danrubel): enhance dartanalyzer to provide this type of summary
|
// TODO(danrubel): enhance dartanalyzer to provide this type of summary
|
||||||
if (!flutterRepo) {
|
if (!flutterRepo) {
|
||||||
|
if (argResults['dartdocs'])
|
||||||
|
throwToolExit('The --dartdocs option is currently only supported with --flutter-repo.');
|
||||||
|
|
||||||
final List<String> arguments = <String>[];
|
final List<String> arguments = <String>[];
|
||||||
arguments.addAll(dartFiles.map((FileSystemEntity f) => f.path));
|
arguments.addAll(dartFiles.map((FileSystemEntity f) => f.path));
|
||||||
|
|
||||||
@ -124,8 +126,6 @@ class AnalyzeOnce extends AnalyzeBase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO (pq): revisit package and directory defaults
|
|
||||||
|
|
||||||
for (Directory dir in repoPackages) {
|
for (Directory dir in repoPackages) {
|
||||||
_collectDartFiles(dir, dartFiles);
|
_collectDartFiles(dir, dartFiles);
|
||||||
pubSpecDirectories.add(dir);
|
pubSpecDirectories.add(dir);
|
||||||
|
@ -150,6 +150,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
|
|||||||
@override
|
@override
|
||||||
Future<Null> run(Iterable<String> args) {
|
Future<Null> run(Iterable<String> args) {
|
||||||
// Have an invocation of 'build' print out it's sub-commands.
|
// Have an invocation of 'build' print out it's sub-commands.
|
||||||
|
// TODO(ianh): Move this to the Build command itself somehow.
|
||||||
if (args.length == 1 && args.first == 'build')
|
if (args.length == 1 && args.first == 'build')
|
||||||
args = <String>['build', '-h'];
|
args = <String>['build', '-h'];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user