diff --git a/dev/bots/analyze.dart b/dev/bots/analyze.dart index b39c24daa9..a32f80d98d 100644 --- a/dev/bots/analyze.dart +++ b/dev/bots/analyze.dart @@ -1197,7 +1197,7 @@ Future _runFlutterAnalyze(String workingDirectory, { }) async { return runCommand( flutter, - ['analyze', '--dartdocs', ...options], + ['analyze', ...options], workingDirectory: workingDirectory, ); } diff --git a/dev/devicelab/bin/tasks/dartdocs.dart b/dev/devicelab/bin/tasks/dartdocs.dart index a505cd2165..0bb2d2093c 100644 --- a/dev/devicelab/bin/tasks/dartdocs.dart +++ b/dev/devicelab/bin/tasks/dartdocs.dart @@ -2,70 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:convert'; -import 'dart:io'; - import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/task_result.dart'; -import 'package:flutter_devicelab/framework/utils.dart'; -import 'package:path/path.dart' as path; Future main() async { - final String dot = Platform.isWindows ? '-' : '•'; - await flutter('update-packages'); await task(() async { - final Stopwatch clock = Stopwatch()..start(); - final Process analysis = await startProcess( - path.join(flutterDirectory.path, 'bin', 'flutter'), - ['analyze', '--no-preamble', '--flutter-repo', '--dartdocs'], - workingDirectory: flutterDirectory.path, - ); - int publicMembers = 0; - int otherErrors = 0; - int otherLines = 0; - bool sawFinalLine = false; - await for (String entry in analysis.stdout.transform(utf8.decoder).transform(const LineSplitter())) { - entry = entry.trim(); - print('analyzer stdout: $entry'); - if (entry == 'Building flutter tool...') { - // ignore this line - } else if (entry.startsWith('info $dot Document all public members $dot')) { - publicMembers += 1; - } else if (entry.startsWith('info $dot') || entry.startsWith('warning $dot') || entry.startsWith('error $dot')) { - otherErrors += 1; - } else if (entry.contains(' (ran in ') && !sawFinalLine) { - // ignore this line once - sawFinalLine = true; - } else if (entry.isNotEmpty) { - otherLines += 1; - print('^ not sure what to do with that line ^'); - } - } - await for (final String entry in analysis.stderr.transform(utf8.decoder).transform(const LineSplitter())) { - print('analyzer stderr: $entry'); - if (entry.contains(' (ran in ') && !sawFinalLine) { - // ignore this line once - sawFinalLine = true; - } else { - otherLines += 1; - print('^ not sure what to do with that line ^'); - } - } - final int result = await analysis.exitCode; - clock.stop(); - if (!sawFinalLine) - throw Exception('flutter analyze did not output final message'); - if (publicMembers == 0 && otherErrors == 0 && result != 0) - throw Exception('flutter analyze exited with unexpected error code $result'); - if (publicMembers != 0 && otherErrors != 0 && result == 0) - throw Exception('flutter analyze exited with successful status code despite reporting errors'); - if (otherLines != 0) - throw Exception('flutter analyze had unexpected output (we saw $otherLines unexpected line${ otherLines == 1 ? "" : "s" })'); - final Map data = { - 'members_missing_dartdocs': publicMembers, - 'analysis_errors': otherErrors, - 'elapsed_time_ms': clock.elapsedMilliseconds, - }; - return TaskResult.success(data, benchmarkScoreKeys: data.keys.toList()); + // TODO(jmagman): Remove once dartdocs builder can be deleted + // when https://github.com/flutter/flutter/issues/79798 rolls to stable. + return TaskResult.success(null); }); } diff --git a/dev/prod_builders.json b/dev/prod_builders.json index 31a11930bd..dcb03b16de 100644 --- a/dev/prod_builders.json +++ b/dev/prod_builders.json @@ -114,12 +114,6 @@ "task_name": "linux_customer_testing", "flaky": false }, - { - "name": "Linux dartdocs", - "repo": "flutter", - "task_name": "linux_dartdocs", - "flaky": false - }, { "name": "Linux docs_test", "repo": "flutter", diff --git a/packages/flutter/test_private/test/animated_icons_private_test.dart.tmpl b/packages/flutter/test_private/test/animated_icons_private_test.dart.tmpl index dc84b63cea..689bb398ea 100644 --- a/packages/flutter/test_private/test/animated_icons_private_test.dart.tmpl +++ b/packages/flutter/test_private/test/animated_icons_private_test.dart.tmpl @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: public_member_api_docs + // This is the test for the private implementation of animated icons. // To make the private API accessible from the test we do not import the // material material_animated_icons library, but instead, this test file is an diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart index d1e686e883..aa096f9c4a 100644 --- a/packages/flutter_tools/lib/src/commands/analyze.dart +++ b/packages/flutter_tools/lib/src/commands/analyze.dart @@ -41,8 +41,8 @@ class AnalyzeCommand extends FlutterCommand { help: 'Analyze the current project, if applicable.', defaultsTo: true); argParser.addFlag('dartdocs', negatable: false, - help: 'List every public member that is lacking documentation. ' - '(The "public_member_api_docs" lint must be enabled in "analysis_options.yaml".)', + help: '(deprecated) List every public member that is lacking documentation. ' + 'This command will be removed in a future version of Flutter.', hide: !verboseHelp); argParser.addFlag('watch', help: 'Run analysis continuously, watching the filesystem for changes.', diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart index 02f3ece387..71bc3129f3 100644 --- a/packages/flutter_tools/lib/src/commands/analyze_base.dart +++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart @@ -17,7 +17,6 @@ import '../base/platform.dart'; import '../base/terminal.dart'; import '../base/utils.dart'; import '../cache.dart'; -import '../dart/analysis.dart'; import '../globals_null_migrated.dart' as globals; /// Common behavior for `flutter analyze` and `flutter analyze --watch` @@ -71,12 +70,11 @@ abstract class AnalyzeBase { } } - void writeBenchmark(Stopwatch stopwatch, int errorCount, int membersMissingDocumentation) { + void writeBenchmark(Stopwatch stopwatch, int errorCount) { const String benchmarkOut = 'analysis_benchmark.json'; final Map data = { 'time': stopwatch.elapsedMilliseconds / 1000.0, 'issues': errorCount, - 'missingDartDocs': membersMissingDocumentation, }; fileSystem.file(benchmarkOut).writeAsStringSync(toPrettyJson(data)); logger.printStatus('Analysis benchmark written to $benchmarkOut ($data).'); @@ -85,41 +83,14 @@ abstract class AnalyzeBase { bool get isFlutterRepo => argResults['flutter-repo'] as bool; String get sdkPath => argResults['dart-sdk'] as String ?? artifacts.getArtifactPath(Artifact.engineDartSdkPath); bool get isBenchmarking => argResults['benchmark'] as bool; - bool get isDartDocs => argResults['dartdocs'] as bool; String get protocolTrafficLog => argResults['protocol-traffic-log'] as String; - static int countMissingDartDocs(List errors) { - return errors.where((AnalysisError error) { - return error.code == 'public_member_api_docs'; - }).length; - } - - static String generateDartDocMessage(int undocumentedMembers) { - String dartDocMessage; - - assert(undocumentedMembers >= 0); - switch (undocumentedMembers) { - case 0: - dartDocMessage = 'all public member have documentation'; - break; - case 1: - dartDocMessage = 'one public member lacks documentation'; - break; - default: - dartDocMessage = '$undocumentedMembers public members lack documentation'; - } - - return dartDocMessage; - } - /// Generate an analysis summary for both [AnalyzeOnce], [AnalyzeContinuously]. static String generateErrorsMessage({ @required int issueCount, int issueDiff, int files, @required String seconds, - int undocumentedMembers = 0, - String dartDocMessage = '', }) { final StringBuffer errorsMessage = StringBuffer(issueCount > 0 ? '$issueCount ${pluralize('issue', issueCount)} found.' @@ -138,12 +109,7 @@ abstract class AnalyzeBase { if (files != null) { errorsMessage.write(' • analyzed $files ${pluralize('file', files)}'); } - - if (undocumentedMembers > 0) { - errorsMessage.write(' (ran in ${seconds}s; $dartDocMessage)'); - } else { - errorsMessage.write(' (ran in ${seconds}s)'); - } + errorsMessage.write(' (ran in ${seconds}s)'); return errorsMessage.toString(); } } diff --git a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart index 90d6dc32f1..05e4d6512c 100644 --- a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart +++ b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart @@ -122,15 +122,6 @@ class AnalyzeContinuously extends AnalyzeBase { } } - int issueCount = errors.length; - - // count missing dartdocs - final int undocumentedMembers = AnalyzeBase.countMissingDartDocs(errors); - if (!isDartDocs) { - errors.removeWhere((AnalysisError error) => error.code == 'public_member_api_docs'); - issueCount -= undocumentedMembers; - } - errors.sort(); for (final AnalysisError error in errors) { @@ -142,23 +133,21 @@ class AnalyzeContinuously extends AnalyzeBase { dumpErrors(errors.map((AnalysisError error) => error.toLegacyString())); + final int issueCount = errors.length; final int issueDiff = issueCount - lastErrorCount; lastErrorCount = issueCount; final String seconds = (analysisTimer.elapsedMilliseconds / 1000.0).toStringAsFixed(2); - final String dartDocMessage = AnalyzeBase.generateDartDocMessage(undocumentedMembers); final String errorsMessage = AnalyzeBase.generateErrorsMessage( issueCount: issueCount, issueDiff: issueDiff, files: analyzedPaths.length, seconds: seconds, - undocumentedMembers: undocumentedMembers, - dartDocMessage: dartDocMessage, ); logger.printStatus(errorsMessage); if (firstAnalysis && isBenchmarking) { - writeBenchmark(analysisTimer, issueCount, undocumentedMembers); + writeBenchmark(analysisTimer, issueCount); server.dispose().whenComplete(() { exit(issueCount > 0 ? 1 : 0); }); } diff --git a/packages/flutter_tools/lib/src/commands/analyze_once.dart b/packages/flutter_tools/lib/src/commands/analyze_once.dart index 5e893e8e9b..a648a1a5ed 100644 --- a/packages/flutter_tools/lib/src/commands/analyze_once.dart +++ b/packages/flutter_tools/lib/src/commands/analyze_once.dart @@ -147,14 +147,9 @@ class AnalyzeOnce extends AnalyzeBase { timer?.stop(); } - final int undocumentedMembers = AnalyzeBase.countMissingDartDocs(errors); - if (!isDartDocs) { - errors.removeWhere((AnalysisError error) => error.code == 'public_member_api_docs'); - } - // emit benchmarks if (isBenchmarking) { - writeBenchmark(timer, errors.length, undocumentedMembers); + writeBenchmark(timer, errors.length); } // --write @@ -171,12 +166,9 @@ class AnalyzeOnce extends AnalyzeBase { final int errorCount = errors.length; final String seconds = (timer.elapsedMilliseconds / 1000.0).toStringAsFixed(1); - final String dartDocMessage = AnalyzeBase.generateDartDocMessage(undocumentedMembers); final String errorsMessage = AnalyzeBase.generateErrorsMessage( issueCount: errorCount, seconds: seconds, - undocumentedMembers: undocumentedMembers, - dartDocMessage: dartDocMessage, ); if (errorCount > 0) { diff --git a/packages/flutter_tools/test/commands.shard/hermetic/analyze_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/analyze_test.dart index 520b9fd524..0a03725c57 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/analyze_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/analyze_test.dart @@ -15,21 +15,13 @@ import '../../src/common.dart'; const String _kFlutterRoot = '/data/flutter'; void main() { - testWithoutContext('analyze generate correct DartDoc message', () async { - expect(AnalyzeBase.generateDartDocMessage(0), 'all public member have documentation'); - expect(AnalyzeBase.generateDartDocMessage(1), 'one public member lacks documentation'); - expect(AnalyzeBase.generateDartDocMessage(2), '2 public members lack documentation'); - }); - testWithoutContext('analyze generate correct errors message', () async { expect( AnalyzeBase.generateErrorsMessage( issueCount: 0, seconds: '0.1', - undocumentedMembers: 1, - dartDocMessage: 'one public member lacks documentation', ), - 'No issues found! (ran in 0.1s; one public member lacks documentation)', + 'No issues found! (ran in 0.1s)', ); expect( @@ -38,10 +30,8 @@ void main() { issueDiff: 2, files: 1, seconds: '0.1', - undocumentedMembers: 1, - dartDocMessage: 'one public member lacks documentation', ), - '3 issues found. (2 new) • analyzed 1 file (ran in 0.1s; one public member lacks documentation)', + '3 issues found. (2 new) • analyzed 1 file (ran in 0.1s)', ); }); diff --git a/packages/flutter_tools/test/general.shard/commands/analyze_base_test.dart b/packages/flutter_tools/test/general.shard/commands/analyze_base_test.dart index 2c56d2bea1..6a7d5a4707 100644 --- a/packages/flutter_tools/test/general.shard/commands/analyze_base_test.dart +++ b/packages/flutter_tools/test/general.shard/commands/analyze_base_test.dart @@ -13,28 +13,15 @@ void main() { final String message = AnalyzeBase.generateErrorsMessage( issueCount: 0, seconds: '10', - undocumentedMembers: 0, ); expect(message, 'No issues found! (ran in 10s)'); }); - testWithoutContext('AnalyzeBase message formatting with undocumented issues', () async { - final String message = AnalyzeBase.generateErrorsMessage( - issueCount: 0, - seconds: '10', - undocumentedMembers: 1, - dartDocMessage: 'test' - ); - - expect(message, 'No issues found! (ran in 10s; test)'); - }); - testWithoutContext('AnalyzeBase message formatting with one issue', () async { final String message = AnalyzeBase.generateErrorsMessage( issueCount: 1, seconds: '10', - undocumentedMembers: 0, ); expect(message, '1 issue found. (ran in 10s)'); @@ -44,7 +31,6 @@ void main() { final String message = AnalyzeBase.generateErrorsMessage( issueCount: 10, seconds: '10', - undocumentedMembers: 0, ); expect(message, '10 issues found. (ran in 10s)'); @@ -54,7 +40,6 @@ void main() { final String message = AnalyzeBase.generateErrorsMessage( issueCount: 0, seconds: '10', - undocumentedMembers: 0, files: 10, ); @@ -65,7 +50,6 @@ void main() { final String message = AnalyzeBase.generateErrorsMessage( issueCount: 1, seconds: '10', - undocumentedMembers: 0, issueDiff: 1, ); @@ -76,7 +60,6 @@ void main() { final String message = AnalyzeBase.generateErrorsMessage( issueCount: 0, seconds: '10', - undocumentedMembers: 0, issueDiff: -1, );