Remove the deprecated nodoc option. (#4025)
diff --git a/CHANGELOG.md b/CHANGELOG.md index 007045e..090738a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md
@@ -1,6 +1,7 @@ ## 9.0.0-wip * Remove deprecated `missingCodeBlockLanguage` warning. * Remove the deprecated `templates-dir` option. +* Remove the deprecated `nodoc` option. ## 8.3.4 * The URL for category pages now uses _category name_ instead of
diff --git a/lib/src/dartdoc_options.dart b/lib/src/dartdoc_options.dart index e0eef7f..7ab54a0 100644 --- a/lib/src/dartdoc_options.dart +++ b/lib/src/dartdoc_options.dart
@@ -1207,8 +1207,6 @@ // ignore: unused_element String get _linkToHosted => optionSet['linkTo']['hosted'].valueAt(context); - List<String> get nodoc => optionSet['nodoc'].valueAt(context); - String get output => optionSet['output'].valueAt(context); PackageMeta get packageMeta => optionSet['packageMeta'].valueAt(context); @@ -1501,13 +1499,6 @@ help: 'Allow links to be generated for packages outside this one.', negatable: true), ]), - // Deprecated. Use of this option is reported. - // TODO(srawlins): Remove. - DartdocOptionFileOnly<List<String>>('nodoc', [], resourceProvider, - optionIs: OptionKind.glob, - help: '(deprecated) Dart symbols declared in these files will be ' - 'treated as though they have the @nodoc directive added to their ' - 'documentation comment.'), DartdocOptionArgOnly<String>('output', resourceProvider.pathContext.join('doc', 'api'), resourceProvider, optionIs: OptionKind.dir, help: 'Path to the output directory.'),
diff --git a/lib/src/generator/templates.runtime_renderers.dart b/lib/src/generator/templates.runtime_renderers.dart index 4d4b98b..41f9ba7 100644 --- a/lib/src/generator/templates.runtime_renderers.dart +++ b/lib/src/generator/templates.runtime_renderers.dart
@@ -25772,7 +25772,6 @@ 'linkToUrl', 'maxFileCount', 'maxTotalSize', - 'nodoc', 'optionSet', 'output', 'packageMeta',
diff --git a/lib/src/model/documentation_comment.dart b/lib/src/model/documentation_comment.dart index 83880b2..6aff687 100644 --- a/lib/src/model/documentation_comment.dart +++ b/lib/src/model/documentation_comment.dart
@@ -85,15 +85,9 @@ /// dartdoc's generated output. /// /// An element is considered to be 'nodoc' if any of the following are true: - /// * a global 'nodoc' configuration has been set for this element (this - /// feature is deprecated), /// * the element has no documentation comment, /// * the documentation comment contains the `@nodoc` dartdoc directive. late final bool hasNodoc = () { - if (packageGraph - .configSetsNodocFor(element.library2!.firstFragment.source.fullName)) { - return true; - } if (!hasDocumentationComment) { return false; }
diff --git a/lib/src/model/package_graph.dart b/lib/src/model/package_graph.dart index 6dbe63a..4c0de58 100644 --- a/lib/src/model/package_graph.dart +++ b/lib/src/model/package_graph.dart
@@ -905,38 +905,6 @@ return allElements; } - /// Cache of 'nodoc' configurations. - /// - /// Glob lookups can be expensive, so cache per filename. - final _configSetsNodocFor = HashMap<String, bool>(); - - /// Given an element's [fullName], look up the nodoc configuration data and - /// determine whether to unconditionally treat the element as "nodoc", an - /// attribute indicating that documentation should not be included in - /// dartdoc's generated output. - /// - /// This configuration setting is deprecated. - bool configSetsNodocFor(String fullName) { - return _configSetsNodocFor.putIfAbsent(fullName, () { - var file = resourceProvider.getFile(fullName); - // Direct lookup instead of generating a custom context will save some - // cycles. We can't use the element's [DartdocOptionContext] because that - // might not be where the element was defined, which is what's important - // for nodoc's semantics. Looking up the defining element just to pull - // a context is again, slow. - var globs = (config.optionSet['nodoc'].valueAt(file.parent) as List) - .cast<String>(); - if (globs.isNotEmpty) { - packageGraph.defaultPackage.warn( - PackageWarning.deprecated, - message: - "The '--nodoc' option is deprecated, and will soon be removed.", - ); - } - return utils.matchGlobs(globs, fullName); - }); - } - /// Returns a macro by [name], or `null` if no macro is found. String? getMacro(String name) { assert(_localDocumentationBuilt);
diff --git a/test/end2end/model_test.dart b/test/end2end/model_test.dart index 319b2af..8921abe 100644 --- a/test/end2end/model_test.dart +++ b/test/end2end/model_test.dart
@@ -1158,22 +1158,6 @@ }); }); - group('Comment processing', () { - test('can virtually add nodoc via options file', () { - var NodocMeLibrary = - packageGraph.defaultPackage.allLibraries.named('nodocme'); - expect(NodocMeLibrary.hasNodoc, isTrue); - var NodocMeImplementation = - fakeLibrary.classes.named('NodocMeImplementation'); - expect(NodocMeImplementation.hasNodoc, isTrue); - expect(NodocMeImplementation.isPublic, isFalse); - var MeNeitherEvenWithoutADocComment = - fakeLibrary.classes.named('MeNeitherEvenWithoutADocComment'); - expect(MeNeitherEvenWithoutADocComment.hasNodoc, isTrue); - expect(MeNeitherEvenWithoutADocComment.isPublic, isFalse); - }); - }); - group('doc references', () { late final String docsAsHtml;
diff --git a/testing/test_package/dartdoc_options.yaml b/testing/test_package/dartdoc_options.yaml index 62cc21f..81b41de 100644 --- a/testing/test_package/dartdoc_options.yaml +++ b/testing/test_package/dartdoc_options.yaml
@@ -7,7 +7,6 @@ Unreal: markdown: "Unreal.md" Real Libraries: - nodoc: ["lib/src/nodoc*.dart"] tools: drill: command: ["bin/drill.dart"]
diff --git a/testing/test_package/lib/fake.dart b/testing/test_package/lib/fake.dart index e42bcc1..4ed5131 100644 --- a/testing/test_package/lib/fake.dart +++ b/testing/test_package/lib/fake.dart
@@ -79,9 +79,6 @@ import 'two_exports.dart' show BaseClass; export 'src/notadotdartfile'; -// Verify that even though reexported, objects don't show in documentation. -export 'package:test_package/src/nodocme.dart'; - // ignore: uri_does_not_exist export 'package:test_package_imported/categoryExporting.dart' show IAmAClassWithCategories;
diff --git a/testing/test_package/lib/src/nodocme.dart b/testing/test_package/lib/src/nodocme.dart deleted file mode 100644 index 707a399..0000000 --- a/testing/test_package/lib/src/nodocme.dart +++ /dev/null
@@ -1,11 +0,0 @@ -/// -/// The library nodocme should never have any members documented, even if -/// reexported, due to dartdoc_options.yaml in the package root. -/// - -library nodocme; - -/// I should not appear in documentation. -class NodocMeImplementation {} - -class MeNeitherEvenWithoutADocComment {}