Skip to content

Commit 4a505cf

Browse files
authored
Canonicalization scorer (#1455)
* First stab at disambiguation, but needs to be extracted * scorer in pretty good shape now * beginnings of being able to set canonicalization manually * intermediate state: moving to library-based canonicalFor declaration * intermediate state -- autoinclude deps broken * intermediate: tests written and working * test really works now. * regen test docs * Add new test doc directories * dartfmt * Comment typo. * Fix --auto-include-deps * cleanup * rebuild docs * Helper moved with the fix. * Hide the debug option for the scorer confidence * Remove unnecessary casts * Implement review comments and extract namePieces into Nameable * Regenerate docs
1 parent 278713e commit 4a505cf

Some content is hidden

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

51 files changed

+4312
-107
lines changed

bin/dartdoc.dart

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ main(List<String> arguments) async {
152152
generator.onFileCreated.listen(_onProgress);
153153
}
154154

155-
var addCrossdart = args['add-crossdart'] as bool;
156-
var includeSource = args['include-source'] as bool;
157-
158155
DartSdk sdk = new FolderBasedDartSdk(PhysicalResourceProvider.INSTANCE,
159156
PhysicalResourceProvider.INSTANCE.getFolder(sdkDir.path));
160157

@@ -181,14 +178,17 @@ main(List<String> arguments) async {
181178
}
182179

183180
setConfig(
184-
addCrossdart: addCrossdart,
181+
addCrossdart: args['add-crossdart'],
185182
examplePathPrefix: args['example-path-prefix'],
186183
showWarnings: args['show-warnings'],
187-
includeSource: includeSource,
184+
includeSource: args['include-source'],
188185
inputDir: inputDir,
189186
sdkVersion: sdk.sdkVersion,
190187
autoIncludeDependencies: args['auto-include-dependencies'],
191188
categoryOrder: args['category-order'],
189+
reexportMinConfidence:
190+
double.parse(args['ambiguous-reexport-scorer-min-confidence']),
191+
verboseWarnings: args['verbose-warnings'],
192192
dropTextFrom: dropTextFrom);
193193

194194
DartDoc dartdoc = new DartDoc(inputDir, excludeLibraries, sdkDir, generators,
@@ -289,6 +289,15 @@ ArgParser _createArgsParser() {
289289
"Generates `index.json` with indentation and newlines. The file is larger, but it's also easier to diff.",
290290
negatable: false,
291291
defaultsTo: false);
292+
parser.addOption('ambiguous-reexport-scorer-min-confidence',
293+
help:
294+
'Minimum scorer confidence to suppress warning on ambiguous reexport.',
295+
defaultsTo: "0.1",
296+
hide: true);
297+
parser.addFlag('verbose-warnings',
298+
help: 'Display extra debugging information and help with warnings.',
299+
negatable: true,
300+
defaultsTo: true);
292301
parser.addFlag(
293302
'hide-sdk-text',
294303
help:

lib/src/config.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class Config {
1616
final String sdkVersion;
1717
final bool autoIncludeDependencies;
1818
final List<String> categoryOrder;
19+
final double reexportMinConfidence;
20+
final bool verboseWarnings;
1921
final List<String> dropTextFrom;
2022
Config._(
2123
this.inputDir,
@@ -26,6 +28,8 @@ class Config {
2628
this.sdkVersion,
2729
this.autoIncludeDependencies,
2830
this.categoryOrder,
31+
this.reexportMinConfidence,
32+
this.verboseWarnings,
2933
this.dropTextFrom);
3034
}
3135

@@ -41,6 +45,8 @@ void setConfig(
4145
String sdkVersion,
4246
bool autoIncludeDependencies: false,
4347
List<String> categoryOrder,
48+
double reexportMinConfidence: 0.1,
49+
verboseWarnings: true,
4450
List<String> dropTextFrom}) {
4551
categoryOrder ??= new UnmodifiableListView<String>([]);
4652
dropTextFrom ??= new UnmodifiableListView<String>([]);
@@ -53,5 +59,7 @@ void setConfig(
5359
sdkVersion,
5460
autoIncludeDependencies,
5561
categoryOrder,
62+
reexportMinConfidence,
63+
verboseWarnings,
5664
dropTextFrom);
5765
}

0 commit comments

Comments
 (0)