Skip to content

Commit 1ed3422

Browse files
committed
dartfmt
1 parent b2d317b commit 1ed3422

File tree

16 files changed

+359
-165
lines changed

16 files changed

+359
-165
lines changed

bin/dartdoc.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ ArgParser _createArgsParser() {
178178
defaultsTo: false);
179179
parser.addFlag('sdk-docs',
180180
help: 'Generate ONLY the docs for the Dart SDK.', negatable: false);
181-
parser.addFlag('show-warnings',
182-
help: 'Display warnings.', negatable: false);
181+
parser.addFlag('show-warnings', help: 'Display warnings.', negatable: false);
183182
parser.addFlag('show-progress',
184183
help: 'Display progress indications to console stdout', negatable: false);
185184
parser.addOption('sdk-readme',
@@ -207,8 +206,7 @@ ArgParser _createArgsParser() {
207206
parser.addOption('example-path-prefix',
208207
help: 'Prefix for @example paths.\n(defaults to the project root)');
209208
parser.addOption('rel-canonical-prefix',
210-
help:
211-
'If provided, add a rel="canonical" prefixed with provided value. '
209+
help: 'If provided, add a rel="canonical" prefixed with provided value. '
212210
'Consider using if\nbuilding many versions of the docs for public '
213211
'SEO; learn more at https://goo.gl/gktN6F.');
214212
parser.addFlag('include-source',
@@ -220,7 +218,8 @@ ArgParser _createArgsParser() {
220218
negatable: false,
221219
defaultsTo: false);
222220
parser.addFlag('auto-include-dependencies',
223-
help: 'Include all the used libraries into the docs, even the ones not in the current package or "include-external"',
221+
help:
222+
'Include all the used libraries into the docs, even the ones not in the current package or "include-external"',
224223
negatable: false,
225224
defaultsTo: false);
226225
return parser;

lib/dartdoc.dart

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ class DartDoc {
154154
Package package = new Package(libraries, packageMeta);
155155

156156
if (config != null && config.autoIncludeDependencies) {
157-
final newLibraryElements = _buildLibrariesWithAutoincludedDependencies(package);
157+
final newLibraryElements =
158+
_buildLibrariesWithAutoincludedDependencies(package);
158159
Library.clearLibraryMap();
159160
package = new Package(newLibraryElements, packageMeta);
160161
}
@@ -294,7 +295,8 @@ class DartDoc {
294295
new _Error(error, info.lineInfo, packageMeta.dir.path));
295296
})
296297
.where((_Error error) => error.isError)
297-
.toList()..sort();
298+
.toList()
299+
..sort();
298300

299301
double seconds = _stopwatch.elapsedMilliseconds / 1000.0;
300302
print("Parsed ${libraries.length} "
@@ -368,17 +370,19 @@ class _Error implements Comparable<_Error> {
368370
String toString() => '[${severityName}] ${description}';
369371
}
370372

371-
Iterable<LibraryElement> _buildLibrariesWithAutoincludedDependencies(Package package) {
372-
final List<LibraryElement> newLibraryElements = []..addAll(package.libraries.map((l) => l.element as LibraryElement));
373+
Iterable<LibraryElement> _buildLibrariesWithAutoincludedDependencies(
374+
Package package) {
375+
final List<LibraryElement> newLibraryElements = []
376+
..addAll(package.libraries.map((l) => l.element as LibraryElement));
373377

374378
package.allModelElements.forEach((modelElement) {
375379
modelElement.usedElements.forEach((used) {
376380
if (used != null && used.modelType != null) {
377381
final ModelElement modelTypeElement = used.modelType.element;
378382
final library = package.findLibraryFor(modelTypeElement.element);
379383
if (library == null && modelTypeElement.library != null) {
380-
if (!newLibraryElements.contains(modelTypeElement.library.element)
381-
&& !modelTypeElement.library.name.startsWith("dart:")) {
384+
if (!newLibraryElements.contains(modelTypeElement.library.element) &&
385+
!modelTypeElement.library.name.startsWith("dart:")) {
382386
newLibraryElements.add(modelTypeElement.library.element);
383387
}
384388
}

lib/src/config.dart

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ void setConfig(
3535
String examplePathPrefix,
3636
bool includeSource: true,
3737
bool autoIncludeDependencies: false}) {
38-
_config = new Config._(
39-
inputDir,
40-
showWarnings,
41-
addCrossdart,
42-
examplePathPrefix,
43-
includeSource,
44-
sdkVersion,
45-
autoIncludeDependencies);
38+
_config = new Config._(inputDir, showWarnings, addCrossdart,
39+
examplePathPrefix, includeSource, sdkVersion, autoIncludeDependencies);
4640
}

lib/src/element_type.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ class ElementType {
7878
var type = _type;
7979
if (type is FunctionType) {
8080
Iterable<DartType> typeArguments;
81-
if (type.element is FunctionTypeAliasElement && type.typeFormals.isEmpty) {
81+
if (type.element is FunctionTypeAliasElement &&
82+
type.typeFormals.isEmpty) {
8283
// TODO(jmesserly): simplify check above; we should have a way
8384
// to find instantiated typedefs without consulting the element.
8485
// Also, it will not work if we support typedefs declared inside classes.

lib/src/export_graph.dart

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ class _ExportGraphNode {
1414
/// It returns a "canonical" library element
1515
///
1616
/// That's one of the passed in the arguments, which is the closest if we go up the graph.
17-
_ExportGraphNode canonicalLibraryElement(Iterable<LibraryElement> libraryElements) {
17+
_ExportGraphNode canonicalLibraryElement(
18+
Iterable<LibraryElement> libraryElements) {
1819
if (libraryElements.contains(libraryElement)) {
1920
return this;
2021
} else {
21-
return exportedBy.toList().firstWhere((l) => l.canonicalLibraryElement(libraryElements) != null);
22+
return exportedBy.toList().firstWhere(
23+
(l) => l.canonicalLibraryElement(libraryElements) != null);
2224
}
2325
}
2426
}
@@ -27,15 +29,17 @@ class _ExportGraphNode {
2729
/// the library element from the arguments, adds it to the index, then goes through all
2830
/// the libraries this library element exports, adds them to the index too and also connects
2931
/// them to build a graph.
30-
void _buildSubGraph(Map<String, _ExportGraphNode> map, LibraryElement libraryElement) {
32+
void _buildSubGraph(
33+
Map<String, _ExportGraphNode> map, LibraryElement libraryElement) {
3134
if (!map.containsKey(libraryElement.source.fullName)) {
3235
map[libraryElement.source.fullName] = new _ExportGraphNode(libraryElement);
3336
}
3437
final node = map[libraryElement.source.fullName];
3538
libraryElement.exports.forEach((ExportElement export) {
3639
final exportedLibraryElement = export.exportedLibrary;
3740
if (!map.containsKey(exportedLibraryElement.source.fullName)) {
38-
map[exportedLibraryElement.source.fullName] = new _ExportGraphNode(exportedLibraryElement);
41+
map[exportedLibraryElement.source.fullName] =
42+
new _ExportGraphNode(exportedLibraryElement);
3943
}
4044
final childNode = map[exportedLibraryElement.source.fullName];
4145
childNode.exportedBy.add(node);
@@ -62,7 +66,9 @@ class ExportGraph {
6266
LibraryElement canonicalLibraryElement(Element element) {
6367
if (map.containsKey(element.library.source.fullName)) {
6468
final node = map[element.library.source.fullName];
65-
return node.canonicalLibraryElement(packageLibraryElements)?.libraryElement;
69+
return node
70+
.canonicalLibraryElement(packageLibraryElements)
71+
?.libraryElement;
6672
} else {
6773
return element.library;
6874
}

lib/src/html/html_generator_instance.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class HtmlGeneratorInstance implements HtmlOptions {
5050

5151
void _generateSearchIndex() {
5252
File jsonFile = _createOutputFile(out, 'index.json');
53-
String json = JSON.encode(documentedElements.where((e) => e.isCanonical).map((ModelElement e) {
53+
String json = JSON.encode(
54+
documentedElements.where((e) => e.isCanonical).map((ModelElement e) {
5455
Map data = {
5556
'name': e.name,
5657
'qualifiedName': e.name,

lib/src/html/template_data.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ class FunctionTemplateData extends TemplateData<ModelFunction> {
276276
String get title =>
277277
'${function.name} function - ${library.name} library - Dart API';
278278
@override
279-
String get layoutTitle =>
280-
_layoutTitle(function.nameWithGenerics, 'function', function.isDeprecated);
279+
String get layoutTitle => _layoutTitle(
280+
function.nameWithGenerics, 'function', function.isDeprecated);
281281
@override
282282
String get metaDescription =>
283283
'API docs for the ${function.name} function from the '
@@ -305,8 +305,8 @@ class MethodTemplateData extends TemplateData<Method> {
305305
String get title => '${method.name} method - ${clazz.name} class - '
306306
'${library.name} library - Dart API';
307307
@override
308-
String get layoutTitle =>
309-
_layoutTitle(method.nameWithGenerics, method.fullkind, method.isDeprecated);
308+
String get layoutTitle => _layoutTitle(
309+
method.nameWithGenerics, method.fullkind, method.isDeprecated);
310310
@override
311311
String get metaDescription =>
312312
'API docs for the ${method.name} method from the ${clazz.name} class, '

0 commit comments

Comments
 (0)