Skip to content

Commit d7ca34a

Browse files
committed
Remove the deprecated nodoc option
1 parent c706d6a commit d7ca34a

File tree

5 files changed

+10
-77
lines changed

5 files changed

+10
-77
lines changed

lib/src/dartdoc_options.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,8 +1207,6 @@ class DartdocOptionContext extends DartdocOptionContextBase
12071207
// ignore: unused_element
12081208
String get _linkToHosted => optionSet['linkTo']['hosted'].valueAt(context);
12091209

1210-
List<String> get nodoc => optionSet['nodoc'].valueAt(context);
1211-
12121210
String get output => optionSet['output'].valueAt(context);
12131211

12141212
PackageMeta get packageMeta => optionSet['packageMeta'].valueAt(context);
@@ -1504,13 +1502,6 @@ List<DartdocOption> createDartdocOptions(
15041502
help: 'Allow links to be generated for packages outside this one.',
15051503
negatable: true),
15061504
]),
1507-
// Deprecated. Use of this option is reported.
1508-
// TODO(srawlins): Remove.
1509-
DartdocOptionFileOnly<List<String>>('nodoc', [], resourceProvider,
1510-
optionIs: OptionKind.glob,
1511-
help: '(deprecated) Dart symbols declared in these files will be '
1512-
'treated as though they have the @nodoc directive added to their '
1513-
'documentation comment.'),
15141505
DartdocOptionArgOnly<String>('output',
15151506
resourceProvider.pathContext.join('doc', 'api'), resourceProvider,
15161507
optionIs: OptionKind.dir, help: 'Path to the output directory.'),

lib/src/model/documentation_comment.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,9 @@ mixin DocumentationComment
8585
/// dartdoc's generated output.
8686
///
8787
/// An element is considered to be 'nodoc' if any of the following are true:
88-
/// * a global 'nodoc' configuration has been set for this element (this
89-
/// feature is deprecated),
9088
/// * the element has no documentation comment,
9189
/// * the documentation comment contains the `@nodoc` dartdoc directive.
9290
late final bool hasNodoc = () {
93-
if (packageGraph
94-
.configSetsNodocFor(element.library2!.firstFragment.source.fullName)) {
95-
return true;
96-
}
9791
if (!hasDocumentationComment) {
9892
return false;
9993
}

lib/src/model/package_graph.dart

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,14 @@ class PackageGraph with CommentReferable, Nameable {
170170
e.canonicalModelElement == null ||
171171
e is Library ||
172172
e.enclosingElement!.isCanonical) {
173-
for (var d in e.documentationFrom
174-
.where((d) => d.hasDocumentationComment)) {
173+
for (var d
174+
in e.documentationFrom.where((d) => d.hasDocumentationComment)) {
175175
if (d.needsPrecache && !precachedElements.contains(d)) {
176176
precachedElements.add(d as ModelElement);
177177
futures.add(d.precacheLocalDocs());
178178
// [TopLevelVariable]s get their documentation from getters and
179179
// setters, so should be precached if either has a template.
180-
if (e is TopLevelVariable &&
181-
!precachedElements.contains(e)) {
180+
if (e is TopLevelVariable && !precachedElements.contains(e)) {
182181
precachedElements.add(e);
183182
futures.add(e.precacheLocalDocs());
184183
}
@@ -647,7 +646,8 @@ class PackageGraph with CommentReferable, Nameable {
647646
checkAndAddContainer(modelElement, container);
648647
}
649648
} else if (container is Mixin) {
650-
for (var modelElement in container.superclassConstraints.modelElements) {
649+
for (var modelElement
650+
in container.superclassConstraints.modelElements) {
651651
checkAndAddContainer(modelElement, container);
652652
}
653653
}
@@ -752,8 +752,7 @@ class PackageGraph with CommentReferable, Nameable {
752752
// TODO(keertip): Find a better way to exclude members of extensions
753753
// when libraries are specified using the "--include" flag.
754754
if (library != null && library.isDocumented) {
755-
return getModelFor(e, library,
756-
enclosingContainer: preferredClass);
755+
return getModelFor(e, library, enclosingContainer: preferredClass);
757756
}
758757
}
759758
// TODO(jcollins-g): The data structures should be changed to eliminate
@@ -778,8 +777,7 @@ class PackageGraph with CommentReferable, Nameable {
778777
var setterElement = setter2 == null
779778
? null
780779
: getModelFor(setter2, library) as Accessor;
781-
canonicalModelElement = getModelForPropertyInducingElement(
782-
e, library,
780+
canonicalModelElement = getModelForPropertyInducingElement(e, library,
783781
getter: getterElement, setter: setterElement);
784782
} else {
785783
canonicalModelElement = getModelFor(e, library);
@@ -791,8 +789,7 @@ class PackageGraph with CommentReferable, Nameable {
791789
}
792790
}
793791
// Prefer fields and top-level variables.
794-
if (e is PropertyAccessorElement2 &&
795-
canonicalModelElement is Accessor) {
792+
if (e is PropertyAccessorElement2 && canonicalModelElement is Accessor) {
796793
canonicalModelElement = canonicalModelElement.enclosingCombo;
797794
}
798795
return canonicalModelElement;
@@ -804,8 +801,8 @@ class PackageGraph with CommentReferable, Nameable {
804801
var elem = modelElement.element;
805802
var candidates = <ModelElement>{};
806803
if (lib != null) {
807-
var constructedWithKey = allConstructedModelElements[
808-
ConstructedModelElementsKey(elem, null)];
804+
var constructedWithKey =
805+
allConstructedModelElements[ConstructedModelElementsKey(elem, null)];
809806
if (constructedWithKey != null) {
810807
candidates.add(constructedWithKey);
811808
}
@@ -909,38 +906,6 @@ class PackageGraph with CommentReferable, Nameable {
909906
return allElements;
910907
}
911908

912-
/// Cache of 'nodoc' configurations.
913-
///
914-
/// Glob lookups can be expensive, so cache per filename.
915-
final _configSetsNodocFor = HashMap<String, bool>();
916-
917-
/// Given an element's [fullName], look up the nodoc configuration data and
918-
/// determine whether to unconditionally treat the element as "nodoc", an
919-
/// attribute indicating that documentation should not be included in
920-
/// dartdoc's generated output.
921-
///
922-
/// This configuration setting is deprecated.
923-
bool configSetsNodocFor(String fullName) {
924-
return _configSetsNodocFor.putIfAbsent(fullName, () {
925-
var file = resourceProvider.getFile(fullName);
926-
// Direct lookup instead of generating a custom context will save some
927-
// cycles. We can't use the element's [DartdocOptionContext] because that
928-
// might not be where the element was defined, which is what's important
929-
// for nodoc's semantics. Looking up the defining element just to pull
930-
// a context is again, slow.
931-
var globs = (config.optionSet['nodoc'].valueAt(file.parent) as List)
932-
.cast<String>();
933-
if (globs.isNotEmpty) {
934-
packageGraph.defaultPackage.warn(
935-
PackageWarning.deprecated,
936-
message:
937-
"The '--nodoc' option is deprecated, and will soon be removed.",
938-
);
939-
}
940-
return utils.matchGlobs(globs, fullName);
941-
});
942-
}
943-
944909
/// Returns a macro by [name], or `null` if no macro is found.
945910
String? getMacro(String name) {
946911
assert(_localDocumentationBuilt);

test/end2end/model_test.dart

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,22 +1153,6 @@ void main() async {
11531153
});
11541154
});
11551155

1156-
group('Comment processing', () {
1157-
test('can virtually add nodoc via options file', () {
1158-
var NodocMeLibrary =
1159-
packageGraph.defaultPackage.allLibraries.named('nodocme');
1160-
expect(NodocMeLibrary.hasNodoc, isTrue);
1161-
var NodocMeImplementation =
1162-
fakeLibrary.classes.named('NodocMeImplementation');
1163-
expect(NodocMeImplementation.hasNodoc, isTrue);
1164-
expect(NodocMeImplementation.isPublic, isFalse);
1165-
var MeNeitherEvenWithoutADocComment =
1166-
fakeLibrary.classes.named('MeNeitherEvenWithoutADocComment');
1167-
expect(MeNeitherEvenWithoutADocComment.hasNodoc, isTrue);
1168-
expect(MeNeitherEvenWithoutADocComment.isPublic, isFalse);
1169-
});
1170-
});
1171-
11721156
group('doc references', () {
11731157
late final String docsAsHtml;
11741158

testing/test_package/dartdoc_options.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ dartdoc:
77
Unreal:
88
markdown: "Unreal.md"
99
Real Libraries:
10-
nodoc: ["lib/src/nodoc*.dart"]
1110
tools:
1211
drill:
1312
command: ["bin/drill.dart"]

0 commit comments

Comments
 (0)