Skip to content

silence warnings for anon libs without docs, also silence appveyor build for now #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ install:
- set PATH=%PATH%;%APPDATA%\Pub\Cache\bin
- pub get

# this doesn't seem to be working
build: off

branches:
only:
- disable_builds_for_now

test_script:
- pub run grinder buildbot
2 changes: 1 addition & 1 deletion lib/src/html_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class HtmlGeneratorInstance {
void generateLibrary(Package package, Library lib) {
print('generating docs for library ${lib.name} from ${lib.path}...');

if (!lib.hasDocumentation) {
if (!lib.isAnonymous && !lib.hasDocumentation) {
print(" warning: library '${lib.name}' has no documentation");
}

Expand Down
2 changes: 2 additions & 0 deletions lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ class Library extends ModelElement {
e.nameOffset == element.nameOffset;
}

bool get isAnonymous => element.name == null || element.name.isEmpty;

String get name {
if (_name != null) return _name;

Expand Down
23 changes: 16 additions & 7 deletions test/model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ void main() {
expect(sdkAsPackage.documentation,
startsWith('Welcome to the Dart API reference doc'));
});

test('has anonymous libraries', () {
expect(
package.libraries.where((lib) => lib.name == 'anonymous_library'),
hasLength(1));
expect(
package.libraries
.where((lib) => lib.name == 'another_anonymous_lib'),
hasLength(1));
});
});

group('test small package', () {
Expand All @@ -91,14 +101,17 @@ void main() {
});

group('Library', () {
Library dartAsyncLib;
Library dartAsyncLib, anonLib;

setUp(() {
dartAsyncLib = new Library(
getSdkLibrariesToDocument(
testUtils.sdkDir, testUtils.analyzerHelper.context).first,
sdkAsPackage);

anonLib = package.libraries
.firstWhere((lib) => lib.name == 'anonymous_library');

// Make sure the first library is dart:async
expect(dartAsyncLib.name, 'dart:async');
});
Expand Down Expand Up @@ -151,12 +164,8 @@ void main() {
exLibrary.functions.any((f) => f.name == 'helperFunction'), isFalse);
});

test('anonymous libraries', () {
expect(package.libraries.where((lib) => lib.name == 'anonymous_library'),
hasLength(1));
expect(
package.libraries.where((lib) => lib.name == 'another_anonymous_lib'),
hasLength(1));
test('anonymous lib', () {
expect(anonLib.isAnonymous, isTrue);
});
});

Expand Down