Skip to content

Commit 7764f87

Browse files
authored
Canonicalization overhaul part two (#1390)
* Squash canonicalization overhaul part2 into single commit * Cleanup and add comments * dartfmt * Update changelog, reduce memory usage for link checker * dartfmt * delete dartdoc.iml * Review comments * dartfmt * whitespace in changelog * Comment enhancements * Correct changelog to 'orphaned file checker' * update test package docs -- whitespace change in SDK
1 parent 63ce194 commit 7764f87

File tree

128 files changed

+1799
-664
lines changed

Some content is hidden

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

128 files changed

+1799
-664
lines changed

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,62 @@
1-
## unreleased
2-
3-
* added a new `--footer-text` command-line option, to allow adding additional
4-
text in the package name and copyright section of the footer
5-
* Reduced stack depth by not recomputing findCanonicalLibraryFor (#1381)
1+
## 0.11.0
2+
3+
* Many cleanups to dartdoc stdout/stderr, error messages, and warnings:
4+
* Display fatal errors with 'fatal error' string to distinguish them from ordinary errors
5+
* Upgrades to new Package.warn system.
6+
* Fully integrated all scattered "warnings" (#1369) and added new ones for the link checker.
7+
* Allow for setting which warnings are errors in the library.
8+
* Change location output to something IntelliJ can understand and link to
9+
* Display location output for all warnings including line number plus column, when available
10+
from analyzer (still some bugs in our resolution). It still doesn't do code references quite
11+
right but at least gets you to the neighborhood.
12+
* Add a warn method to ModelElements so they can warn on themselves without help from the
13+
Package.
14+
* Warn correctly and squelch duplicates across doc inheritance and canonicalization almost
15+
everywhere.
16+
* Change --show-warnings to show all warnings, even those that might not be useful yet.
17+
* Display a count of all warnings/errors after document generation.
18+
* Make the progress counter tick slower.
19+
* Added a built-in link checker and orphaned file checker, and tied it into Package.warn so
20+
that when debugging dartdoc we can breakpoint and discover what about that ModelElement
21+
caused us to create the broken link. (#1380)
22+
* Fix bug where canonicalEnclosingElement could return a non-canonical Class.
23+
* Fix bug where findCanonicalModelElementFor could return a non-canonical Class.
24+
* Fix overriddenElement for Accessors to generate using enclosingCombo hint to ModelElement factory.
25+
* Fix fullyQualifiedNameWithoutLibrary when periods are part of the library name.
26+
* Add an allModelElements for Classes to support comment references.
27+
* Make allModelElements for Libraries work using Class.allModelElements recursively.
28+
* Squish some bugs related to duplicate logic for instantiating inherited class members.
29+
* Enum and a few other places could still generate duplicate ModelElements for the
30+
same thing. This is now fixed.
31+
* EnumField is now handled by ModelElement.from factory, fixing #1239.
32+
* Added hints for EnumField and Accessors (index, enclosingCombo) to offload the buggy
33+
logic for figuring this out from callers to ModelElement.from.
34+
* Fix broken link generation when a canonical class's defining library isn't canonical.
35+
* Partial rewrite of GetterSetterCombo and Fields/TopLevelVariable handling
36+
* Link correctly to generic types for Fields/TopLevelVariables.
37+
* Use right, left, and bidirectional arrows for read-only, write-only, and read-write
38+
parameters.
39+
* Partial rewrite of comment reference system (#1391, #1285 partial)
40+
* Handle gracefully a variety of things users try in the real world, like prefixing operators
41+
with 'operator', embedded newlines in comment references, and cases that shouldn't be
42+
considered at all (comment refs that are really array references in sample docs, etc).
43+
* Handle canonicalization correctly for comment references: point to the right places and
44+
only to canonical elements.
45+
* In general, warnings related to comment references should be much more useful now. (#1343)
46+
* Many fewer ambiguous doc reference warnings now and the ones that exist should be more
47+
easily understandable and fixable with the new warning message.
48+
* Understand references to parameters even though we don't do anything useful with them just yet
49+
* Generics outside square brackets (#1250) are now warned with better context information that
50+
takes newlines into account, but there are so many of them in complex packages like Flutter
51+
that we still only show those with --show-warnings.
52+
* Cache the traversal of allModelElements.
53+
* Change handling of enum constant linking in codeRefs to work properly, though warnings about
54+
that aren't right in some edge cases still.
55+
* Only use analyzer resolving of commentRefs as a last resort since they don't take dartdoc
56+
canonicalization into account.
57+
* Added a new `--footer-text` command-line option, to allow adding additional
58+
text in the package name and copyright section of the footer.
59+
* Reduced stack depth by not recomputing findCanonicalLibraryFor. (#1381)
660
* Workaround for (#1367) forces on enableAssertInitializer.
761
* Work around analyzer-0.29 bug where embedded SDK uri's aren't properly
862
reversed.

bin/dartdoc.dart

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ main(List<String> arguments) async {
5555

5656
var readme = args['sdk-readme'];
5757
if (readme != null && !(new File(readme).existsSync())) {
58-
stderr
59-
.write(" Error: unable to locate the SDK description file at $readme.");
58+
stderr.write(
59+
" fatal error: unable to locate the SDK description file at $readme.");
6060
exit(1);
6161
}
6262

6363
Directory inputDir = new Directory(args['input']);
6464
if (!inputDir.existsSync()) {
6565
stderr.write(
66-
" Error: unable to locate the input directory at ${inputDir.path}.");
66+
" fatal error: unable to locate the input directory at ${inputDir.path}.");
6767
exit(1);
6868
}
6969

@@ -77,7 +77,8 @@ main(List<String> arguments) async {
7777
args['header'].map(_resolveTildePath).toList() as List<String>;
7878
for (String headerFilePath in headerFilePaths) {
7979
if (!new File(headerFilePath).existsSync()) {
80-
stderr.write(" Error: unable to locate header file: ${headerFilePath}.");
80+
stderr.write(
81+
" fatal error: unable to locate header file: ${headerFilePath}.");
8182
exit(1);
8283
}
8384
}
@@ -86,7 +87,8 @@ main(List<String> arguments) async {
8687
args['footer'].map(_resolveTildePath).toList() as List<String>;
8788
for (String footerFilePath in footerFilePaths) {
8889
if (!new File(footerFilePath).existsSync()) {
89-
stderr.write(" Error: unable to locate footer file: ${footerFilePath}.");
90+
stderr.write(
91+
" fatal error: unable to locate footer file: ${footerFilePath}.");
9092
exit(1);
9193
}
9294
}
@@ -96,7 +98,7 @@ main(List<String> arguments) async {
9698
for (String footerFilePath in footerTextFilePaths) {
9799
if (!new File(footerFilePath).existsSync()) {
98100
stderr.write(
99-
" Error: unable to locate footer-text file: ${footerFilePath}.");
101+
" fatal error: unable to locate footer-text file: ${footerFilePath}.");
100102
exit(1);
101103
}
102104
}
@@ -110,7 +112,7 @@ main(List<String> arguments) async {
110112
if (args.rest.isNotEmpty) {
111113
var unknownArgs = args.rest.join(' ');
112114
stderr.write(
113-
'Error: detected unknown command-line argument(s): $unknownArgs');
115+
' fatal error: detected unknown command-line argument(s): $unknownArgs');
114116
_printUsageAndExit(parser, exitCode: 1);
115117
}
116118

@@ -120,7 +122,7 @@ main(List<String> arguments) async {
120122

121123
if (!packageMeta.isValid) {
122124
stderr.writeln(
123-
'Unable to generate documentation: ${packageMeta.getInvalidReasons().first}.');
125+
' fatal error: Unable to generate documentation: ${packageMeta.getInvalidReasons().first}.');
124126
exit(1);
125127
}
126128

@@ -165,10 +167,11 @@ main(List<String> arguments) async {
165167
autoIncludeDependencies: args['auto-include-dependencies'],
166168
categoryOrder: args['category-order']);
167169

168-
var dartdoc = new DartDoc(inputDir, excludeLibraries, sdkDir, generators,
170+
DartDoc dartdoc = new DartDoc(inputDir, excludeLibraries, sdkDir, generators,
169171
outputDir, packageMeta, includeLibraries,
170172
includeExternals: includeExternals);
171173

174+
dartdoc.onCheckProgress.listen(_onProgress);
172175
Chain.capture(() async {
173176
DartDocResults results = await dartdoc.generateDocs();
174177
print('\nSuccess! Docs generated into ${results.outDir.absolute.path}');
@@ -218,7 +221,8 @@ ArgParser _createArgsParser() {
218221
parser.addOption('footer-text',
219222
allowMultiple: true,
220223
splitCommas: true,
221-
help: 'paths to footer-text files (optional text next to the copyright).');
224+
help:
225+
'paths to footer-text files (optional text next to the copyright).');
222226
parser.addOption('exclude',
223227
allowMultiple: true, splitCommas: true, help: 'Library names to ignore.');
224228
parser.addOption('include',
@@ -264,8 +268,12 @@ ArgParser _createArgsParser() {
264268
return parser;
265269
}
266270

267-
void _onProgress(File file) {
268-
if (_showProgress) stdout.write('.');
271+
int _progressCounter = 0;
272+
void _onProgress(var file) {
273+
if (_showProgress && _progressCounter % 5 == 0) {
274+
stdout.write('.');
275+
}
276+
_progressCounter += 1;
269277
}
270278

271279
/// Print help if we are passed the help option.

dartdoc.iml

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)