Commit ab8202dc authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Track missing dartdocs (#10213)

This will help catch when we accidentally break --dartdocs.
parent 55f0aee9
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
Future<Null> main() async {
await task(() async {
final Stopwatch clock = new Stopwatch()..start();
final Process analysis = await startProcess(
'flutter',
<String>['analyze', '--flutter-repo', '--dartdocs'],
workingDirectory: flutterDirectory.path,
);
int publicMembers = 0;
int otherErrors = 0;
int otherLines = 0;
await for (String entry in analysis.stderr.transform(UTF8.decoder).transform(const LineSplitter())) {
print('analyzer stderr: $entry');
if (entry.startsWith('[lint] Document all public members')) {
publicMembers += 1;
} else if (entry.startsWith('[')) {
otherErrors += 1;
} else if (entry.startsWith('(Ran in ')) {
// ignore this line
} else {
otherLines += 1;
}
}
await for (String entry in analysis.stdout.transform(UTF8.decoder).transform(const LineSplitter())) {
print('analyzer stdout: $entry');
if (entry == 'Building flutter tool...') {
// ignore this line
} else if (entry.startsWith('Analyzing ')) {
// ignore this line
} else {
otherLines += 1;
}
}
final int result = await analysis.exitCode;
clock.stop();
if (publicMembers == 0 && otherErrors == 0 && result != 0)
throw new Exception('flutter analyze exited with unexpected error code $result');
if (publicMembers != 0 && otherErrors != 0 && result == 0)
throw new Exception('flutter analyze exited with successful status code despite reporting errors');
if (otherLines != 0)
throw new Exception('flutter analyze had unexpected output (we saw $otherLines unexpected line${ otherLines == 1 ? "" : "s" })');
final Map<String, dynamic> data = <String, dynamic>{
'members_missing_dartdocs': publicMembers,
'analysis_errors': otherErrors,
'elapsed_time_ms': clock.elapsedMilliseconds,
};
return new TaskResult.success(data, benchmarkScoreKeys: data.keys.toList());
});
}
......@@ -75,6 +75,12 @@ tasks:
stage: devicelab
required_agent_capabilities: ["has-android-device"]
dartdocs:
description: >
Tracks how many members are still lacking documentation.
stage: devicelab
required_agent_capabilities: ["has-android-device"]
# Android on-device tests
complex_layout_scroll_perf__timeline_summary:
......@@ -190,14 +196,14 @@ tasks:
# Measures the startup time of the Flutter Gallery app on iOS.
# stage: devicelab_ios
# required_agent_capabilities: ["has-ios-device"]
# flaky: true
# flaky: true
# complex_layout_ios__start_up:
# description: >
# Measures the startup time of the Complex Layout sample app on iOS.
# stage: devicelab_ios
# required_agent_capabilities: ["has-ios-device"]
# flaky: true
# flaky: true
flutter_gallery_ios__transition_perf:
description: >
......@@ -225,7 +231,7 @@ tasks:
# Verifies that Flutter View can be used from an iOS project.
# stage: devicelab_ios
# required_agent_capabilities: ["has-ios-device"]
# flaky: true
# flaky: true
integration_ui_ios:
description: >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment