Skip to content

Commit d2d9c81

Browse files
committed
Bump to 3.9.0 and reformat
1 parent d90a06d commit d2d9c81

File tree

136 files changed

+10618
-6554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+10618
-6554
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
os: [ubuntu-latest]
25-
sdk: [3.8.0, dev]
25+
sdk: [3.9.0, dev]
2626
job: [main, flutter, packages, sdk-docs]
2727
include:
2828
- os: macos-latest

bin/dartdoc.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ void main(List<String> arguments) {
1818
return;
1919
}
2020
final packageConfigProvider = PhysicalPackageConfigProvider();
21-
final packageBuilder =
22-
PubPackageBuilder(config, pubPackageMetaProvider, packageConfigProvider);
21+
final packageBuilder = PubPackageBuilder(
22+
config,
23+
pubPackageMetaProvider,
24+
packageConfigProvider,
25+
);
2326
Dartdoc.fromContext(config, packageBuilder).executeGuarded();
2427
}

lib/src/comment_references/model_comment_reference.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ModelCommentReference {
2424
/// Constructs a [ModelCommentReference] given a raw string.
2525
ModelCommentReference(this._codeRef);
2626

27-
late final List<CommentReferenceNode> _parsed =
28-
CommentReferenceParser(_codeRef).parse();
27+
late final List<CommentReferenceNode> _parsed = CommentReferenceParser(
28+
_codeRef,
29+
).parse();
2930
}

lib/src/comment_references/parser.dart

Lines changed: 62 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const Map<String, String> operatorNames = {
2626
'|': 'bitwise_or',
2727
'&': 'bitwise_and',
2828
'~/': 'truncate_divide',
29-
'%': 'modulo'
29+
'%': 'modulo',
3030
};
3131

3232
class StringTrie {
@@ -132,8 +132,10 @@ class CommentReferenceParser {
132132
_TypeVariablesResultType.parsedTypeVariables) {
133133
children.add(typeVariablesResult.node!);
134134
} else {
135-
assert(typeVariablesResult.type ==
136-
_TypeVariablesResultType.notTypeVariables);
135+
assert(
136+
typeVariablesResult.type ==
137+
_TypeVariablesResultType.notTypeVariables,
138+
);
137139
}
138140
}
139141
if (_atEnd || _thisChar != $dot) {
@@ -169,8 +171,9 @@ class CommentReferenceParser {
169171
return _PrefixParseResult.endOfFile;
170172
}
171173
_walkPastWhitespace();
172-
if (_ignorePrefixes
173-
.any((p) => _tryMatchLiteral(p, requireTrailingNonidentifier: true))) {
174+
if (_ignorePrefixes.any(
175+
(p) => _tryMatchLiteral(p, requireTrailingNonidentifier: true),
176+
)) {
174177
return _PrefixParseResult.junk;
175178
}
176179

@@ -239,7 +242,8 @@ class CommentReferenceParser {
239242
_index++;
240243
}
241244
return _IdentifierParseResult.ok(
242-
IdentifierNode(_codeRef.substring(startIndex, _index)));
245+
IdentifierNode(_codeRef.substring(startIndex, _index)),
246+
);
243247
}
244248

245249
/// Parses a list of type variables (arguments or parameters).
@@ -253,7 +257,8 @@ class CommentReferenceParser {
253257
var startIndex = _index;
254258
if (_matchBraces($lt, $gt)) {
255259
return _TypeVariablesParseResult.ok(
256-
TypeVariablesNode(_codeRef.substring(startIndex + 1, _index - 1)));
260+
TypeVariablesNode(_codeRef.substring(startIndex + 1, _index - 1)),
261+
);
257262
}
258263
return _TypeVariablesParseResult.notIdentifier;
259264
}
@@ -281,7 +286,8 @@ class CommentReferenceParser {
281286
if (_tryMatchLiteral(_callableHintSuffix)) {
282287
if (_atEnd) {
283288
return _SuffixParseResult.ok(
284-
CallableHintEndNode(_codeRef.substring(startIndex, _index)));
289+
CallableHintEndNode(_codeRef.substring(startIndex, _index)),
290+
);
285291
}
286292
return _SuffixParseResult.notSuffix;
287293
}
@@ -301,14 +307,18 @@ class CommentReferenceParser {
301307
int get _thisChar => _codeRef.codeUnitAt(_index);
302308

303309
/// Advances [_index] on match, preserves on non-match.
304-
bool _tryMatchLiteral(String characters,
305-
{bool acceptTrailingWhitespace = true,
306-
bool requireTrailingNonidentifier = false}) {
310+
bool _tryMatchLiteral(
311+
String characters, {
312+
bool acceptTrailingWhitespace = true,
313+
bool requireTrailingNonidentifier = false,
314+
}) {
307315
if (characters.length + _index > _referenceLength) return false;
308316
int startIndex;
309-
for (startIndex = _index;
310-
_index - startIndex < characters.length;
311-
_index++) {
317+
for (
318+
startIndex = _index;
319+
_index - startIndex < characters.length;
320+
_index++
321+
) {
312322
if (_codeRef.codeUnitAt(_index) !=
313323
characters.codeUnitAt(_index - startIndex)) {
314324
_index = startIndex;
@@ -377,14 +387,20 @@ class _PrefixParseResult {
377387

378388
const _PrefixParseResult._(this.type, this.node);
379389

380-
static const _PrefixParseResult endOfFile =
381-
_PrefixParseResult._(_PrefixResultType.endOfFile, null);
390+
static const _PrefixParseResult endOfFile = _PrefixParseResult._(
391+
_PrefixResultType.endOfFile,
392+
null,
393+
);
382394

383-
static const _PrefixParseResult junk =
384-
_PrefixParseResult._(_PrefixResultType.junk, null);
395+
static const _PrefixParseResult junk = _PrefixParseResult._(
396+
_PrefixResultType.junk,
397+
null,
398+
);
385399

386-
static const _PrefixParseResult missing =
387-
_PrefixParseResult._(_PrefixResultType.missing, null);
400+
static const _PrefixParseResult missing = _PrefixParseResult._(
401+
_PrefixResultType.missing,
402+
null,
403+
);
388404
}
389405

390406
enum _IdentifierResultType {
@@ -405,11 +421,15 @@ class _IdentifierParseResult {
405421
factory _IdentifierParseResult.ok(IdentifierNode node) =>
406422
_IdentifierParseResult._(_IdentifierResultType.parsedIdentifier, node);
407423

408-
static const _IdentifierParseResult endOfFile =
409-
_IdentifierParseResult._(_IdentifierResultType.endOfFile, null);
424+
static const _IdentifierParseResult endOfFile = _IdentifierParseResult._(
425+
_IdentifierResultType.endOfFile,
426+
null,
427+
);
410428

411-
static const _IdentifierParseResult notIdentifier =
412-
_IdentifierParseResult._(_IdentifierResultType.notIdentifier, null);
429+
static const _IdentifierParseResult notIdentifier = _IdentifierParseResult._(
430+
_IdentifierResultType.notIdentifier,
431+
null,
432+
);
413433
}
414434

415435
enum _TypeVariablesResultType {
@@ -432,14 +452,18 @@ class _TypeVariablesParseResult {
432452

433453
factory _TypeVariablesParseResult.ok(TypeVariablesNode node) =>
434454
_TypeVariablesParseResult._(
435-
_TypeVariablesResultType.parsedTypeVariables, node);
455+
_TypeVariablesResultType.parsedTypeVariables,
456+
node,
457+
);
436458

437459
static const _TypeVariablesParseResult endOfFile =
438460
_TypeVariablesParseResult._(_TypeVariablesResultType.endOfFile, null);
439461

440462
static const _TypeVariablesParseResult notIdentifier =
441463
_TypeVariablesParseResult._(
442-
_TypeVariablesResultType.notTypeVariables, null);
464+
_TypeVariablesResultType.notTypeVariables,
465+
null,
466+
);
443467
}
444468

445469
enum _SuffixResultType {
@@ -460,14 +484,20 @@ class _SuffixParseResult {
460484
factory _SuffixParseResult.ok(CommentReferenceNode node) =>
461485
_SuffixParseResult._(_SuffixResultType.parsedCallableHint, node);
462486

463-
static const _SuffixParseResult junk =
464-
_SuffixParseResult._(_SuffixResultType.junk, null);
487+
static const _SuffixParseResult junk = _SuffixParseResult._(
488+
_SuffixResultType.junk,
489+
null,
490+
);
465491

466-
static const _SuffixParseResult missing =
467-
_SuffixParseResult._(_SuffixResultType.missing, null);
492+
static const _SuffixParseResult missing = _SuffixParseResult._(
493+
_SuffixResultType.missing,
494+
null,
495+
);
468496

469-
static const _SuffixParseResult notSuffix =
470-
_SuffixParseResult._(_SuffixResultType.notSuffix, null);
497+
static const _SuffixParseResult notSuffix = _SuffixParseResult._(
498+
_SuffixResultType.notSuffix,
499+
null,
500+
);
471501
}
472502

473503
// TODO(jcollins-g): add SourceSpans?
@@ -500,7 +530,6 @@ class IdentifierNode extends CommentReferenceNode {
500530
/// comma separated.
501531
class TypeVariablesNode extends CommentReferenceNode {
502532
@override
503-
504533
/// Note that this will contain commas, spaces, and other text, as
505534
/// generally type variables are a form of junk that comment references
506535
/// should ignore.

lib/src/dartdoc.dart

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ class NoFileWriter implements FileWriter {
3535
}
3636

3737
@override
38-
void writeBytes(String filePath, List<int> content,
39-
{bool allowOverwrite = false}) {
38+
void writeBytes(
39+
String filePath,
40+
List<int> content, {
41+
bool allowOverwrite = false,
42+
}) {
4043
// Do nothing
4144
}
4245

@@ -62,19 +65,21 @@ class DartdocFileWriter implements FileWriter {
6265
this._resourceProvider, {
6366
int maxFileCount = 0,
6467
int maxTotalSize = 0,
65-
}) : _maxFileCount = maxFileCount,
66-
_maxTotalSize = maxTotalSize;
68+
}) : _maxFileCount = maxFileCount,
69+
_maxTotalSize = maxTotalSize;
6770

6871
void _validateMaxWriteStats(String filePath, int size) {
6972
_fileCount++;
7073
_totalSize += size;
7174
if (_maxFileCount > 0 && _maxFileCount < _fileCount) {
7275
throw DartdocFailure(
73-
'Maximum file count reached: $_maxFileCount ($filePath)');
76+
'Maximum file count reached: $_maxFileCount ($filePath)',
77+
);
7478
}
7579
if (_maxTotalSize > 0 && _maxTotalSize < _totalSize) {
7680
throw DartdocFailure(
77-
'Maximum total size reached: $_maxTotalSize bytes ($filePath)');
81+
'Maximum total size reached: $_maxTotalSize bytes ($filePath)',
82+
);
7883
}
7984
}
8085

@@ -118,21 +123,28 @@ class DartdocFileWriter implements FileWriter {
118123

119124
void _warnAboutOverwrite(String outFile, Warnable? element) {
120125
if (_fileElementMap.containsKey(outFile)) {
121-
assert(element != null,
122-
'Attempted overwrite of $outFile without corresponding element');
126+
assert(
127+
element != null,
128+
'Attempted overwrite of $outFile without corresponding element',
129+
);
123130
var originalElement = _fileElementMap[outFile];
124-
var referredFrom =
125-
originalElement == null ? const <Warnable>[] : [originalElement];
126-
element?.warn(PackageWarning.duplicateFile,
127-
message: outFile, referredFrom: referredFrom);
131+
var referredFrom = originalElement == null
132+
? const <Warnable>[]
133+
: [originalElement];
134+
element?.warn(
135+
PackageWarning.duplicateFile,
136+
message: outFile,
137+
referredFrom: referredFrom,
138+
);
128139
}
129140
}
130141

131142
/// Returns the file at [outFile] relative to [_outputDir], creating the
132143
/// parent directory if necessary.
133144
File _getFile(String outFile) {
134-
var file = _resourceProvider
135-
.getFile(_resourceProvider.pathContext.join(_outputDir, outFile));
145+
var file = _resourceProvider.getFile(
146+
_resourceProvider.pathContext.join(_outputDir, outFile),
147+
);
136148
var parent = file.parent;
137149
if (!parent.exists) {
138150
parent.create();
@@ -150,8 +162,9 @@ class Dartdoc {
150162
final Folder _outputDir;
151163

152164
// Fires when the self checks make progress.
153-
final StreamController<String> _onCheckProgress =
154-
StreamController(sync: true);
165+
final StreamController<String> _onCheckProgress = StreamController(
166+
sync: true,
167+
);
155168

156169
Dartdoc._(this.config, this._outputDir, this._generator, this.packageBuilder);
157170

@@ -202,21 +215,29 @@ class Dartdoc {
202215
var writtenFiles = generator.writtenFiles;
203216
if (config.validateLinks && writtenFiles.isNotEmpty) {
204217
runtimeStats.startPerfTask('validateLinks');
205-
Validator(packageGraph, config, _outputDir.path, writtenFiles,
206-
_onCheckProgress)
207-
.validateLinks();
218+
Validator(
219+
packageGraph,
220+
config,
221+
_outputDir.path,
222+
writtenFiles,
223+
_onCheckProgress,
224+
).validateLinks();
208225
runtimeStats.endPerfTask();
209226
}
210227

211228
var warnings = packageGraph.packageWarningCounter.warningCount;
212229
var errors = packageGraph.packageWarningCounter.errorCount;
213-
logWarning("Found $warnings ${pluralize('warning', warnings)} "
214-
"and $errors ${pluralize('error', errors)}.");
230+
logWarning(
231+
"Found $warnings ${pluralize('warning', warnings)} "
232+
"and $errors ${pluralize('error', errors)}.",
233+
);
215234

216235
var seconds = stopwatch.elapsedMilliseconds / 1000.0;
217236
libs = packageGraph.localPublicLibraries.length;
218-
logInfo("Documented $libs public librar${libs == 1 ? 'y' : 'ies'} "
219-
'in ${seconds.toStringAsFixed(1)} seconds');
237+
logInfo(
238+
"Documented $libs public librar${libs == 1 ? 'y' : 'ies'} "
239+
'in ${seconds.toStringAsFixed(1)} seconds',
240+
);
220241

221242
if (config.showStats) {
222243
logInfo(runtimeStats.buildReport());
@@ -244,8 +265,9 @@ class Dartdoc {
244265
if (errorCount > 0) {
245266
throw DartdocFailure('encountered $errorCount errors');
246267
}
247-
var outDirPath = config.resourceProvider.pathContext
248-
.absolute(dartdocResults.outDir.path);
268+
var outDirPath = config.resourceProvider.pathContext.absolute(
269+
dartdocResults.outDir.path,
270+
);
249271
logInfo('Success! Docs generated into $outDirPath');
250272
return dartdocResults;
251273
} finally {

0 commit comments

Comments
 (0)