Skip to content

Commit

Permalink
Merge 9cf09c8 into b3ffca1
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough authored Mar 3, 2021
2 parents b3ffca1 + 9cf09c8 commit 75a3c1e
Show file tree
Hide file tree
Showing 29 changed files with 86 additions and 88 deletions.
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change analysis_options.yaml and analysis_options_presubmit.yaml
# together.
include: package:pedantic/analysis_options.1.9.0.yaml
include: package:pedantic/analysis_options.1.11.0.yaml

analyzer:
errors:
Expand Down
2 changes: 1 addition & 1 deletion analysis_options_presubmit.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change analysis_options.yaml and analysis_options_presubmit.yaml
# together.
include: package:pedantic/analysis_options.1.9.0.yaml
include: package:pedantic/analysis_options.1.11.0.yaml

analyzer:
errors:
Expand Down
14 changes: 7 additions & 7 deletions lib/dartdoc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DartdocFileWriter implements FileWriter {
if (!allowOverwrite) {
if (_fileElementMap.containsKey(outFile)) {
assert(element != null,
'Attempted overwrite of ${outFile} without corresponding element');
'Attempted overwrite of $outFile without corresponding element');
var originalElement = _fileElementMap[outFile];
Iterable<Warnable> referredFrom =
originalElement != null ? [originalElement] : null;
Expand Down Expand Up @@ -183,7 +183,7 @@ class Dartdoc {
packageGraph = await packageBuilder.buildPackageGraph();
seconds = _stopwatch.elapsedMilliseconds / 1000.0;
var libs = packageGraph.libraries.length;
logInfo("Initialized dartdoc with ${libs} librar${libs == 1 ? 'y' : 'ies'} "
logInfo("Initialized dartdoc with $libs librar${libs == 1 ? 'y' : 'ies'} "
'in ${seconds.toStringAsFixed(1)} seconds');
_stopwatch.reset();

Expand All @@ -206,13 +206,13 @@ class Dartdoc {
if (warnings == 0 && errors == 0) {
logInfo('no issues found');
} else {
logWarning("Found ${warnings} ${pluralize('warning', warnings)} "
"and ${errors} ${pluralize('error', errors)}.");
logWarning("Found $warnings ${pluralize('warning', warnings)} "
"and $errors ${pluralize('error', errors)}.");
}

seconds = _stopwatch.elapsedMilliseconds / 1000.0;
libs = packageGraph.localPublicLibraries.length;
logInfo("Documented ${libs} public librar${libs == 1 ? 'y' : 'ies'} "
logInfo("Documented $libs public librar${libs == 1 ? 'y' : 'ies'} "
'in ${seconds.toStringAsFixed(1)} seconds');
return DartdocResults(config.topLevelPackageMeta, packageGraph, outputDir);
}
Expand Down Expand Up @@ -489,10 +489,10 @@ class Dartdoc {
},
(e, chain) {
if (e is DartdocFailure) {
stderr.writeln('\ndartdoc failed: ${e}.');
stderr.writeln('\ndartdoc failed: $e.');
exitCode = 1;
} else {
stderr.writeln('\ndartdoc failed: ${e}\n${chain}');
stderr.writeln('\ndartdoc failed: $e\n$chain');
exitCode = 255;
}
},
Expand Down
2 changes: 1 addition & 1 deletion lib/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ void _printUsage(ArgParser parser) {

/// Print version information.
void _printVersion(ArgParser parser) {
print('dartdoc version: ${dartdocVersion}');
print('dartdoc version: $dartdocVersion');
}
27 changes: 13 additions & 14 deletions lib/src/dartdoc_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class CategoryConfiguration {
.join(canonicalYamlPath, documentationMarkdown));
if (!resourceProvider.getFile(documentationMarkdown).exists) {
throw DartdocFileMissing(
'In categories definition for ${name}, "markdown" resolves to '
'In categories definition for $name, "markdown" resolves to '
'the missing file $documentationMarkdown');
}
}
Expand Down Expand Up @@ -860,10 +860,10 @@ abstract class DartdocSyntheticOption<T> implements DartdocOption<T> {

void _onMissingFromSynthetic(
_OptionValueWithContext<Object> valueWithContext, String missingPath) {
var description = 'Synthetic configuration option ${name} from <internal>';
var description = 'Synthetic configuration option $name from <internal>';
throw DartdocFileMissing(
'$description, computed as ${valueWithContext.value}, resolves to '
'missing path: "${missingPath}"');
'missing path: "$missingPath"');
}
}

Expand Down Expand Up @@ -1062,9 +1062,8 @@ abstract class _DartdocFileOption<T> implements DartdocOption<T> {
_OptionValueWithContext<Object> valueWithContext, String missingPath) {
var dartdocYaml = resourceProvider.pathContext.join(
valueWithContext.canonicalDirectoryPath, valueWithContext.definingFile);
throw DartdocFileMissing('Field ${fieldName} from ${dartdocYaml}, set to '
'${valueWithContext.value}, resolves to missing path: '
'"${missingPath}"');
throw DartdocFileMissing('Field $fieldName from $dartdocYaml, set to '
'${valueWithContext.value}, resolves to missing path: "$missingPath"');
}

@override
Expand Down Expand Up @@ -1174,7 +1173,7 @@ abstract class _DartdocFileOption<T> implements DartdocOption<T> {
returnData = yamlData;
}
} else {
throw UnsupportedError('Type ${T} is not supported');
throw UnsupportedError('Type $T is not supported');
}
return _OptionValueWithContext(returnData as T, contextPath,
definingFile: 'dartdoc_options.yaml');
Expand Down Expand Up @@ -1245,8 +1244,8 @@ abstract class _DartdocArgOption<T> implements DartdocOption<T> {
example = '0.76';
}
throw DartdocOptionError(
'Invalid argument value: --${argName}, set to "${value}", must be a '
'${T}. Example: --${argName} ${example}');
'Invalid argument value: --$argName, set to "$value", must be a '
'$T. Example: --$argName $example');
}

/// Returns null if no argument was given on the command line.
Expand All @@ -1263,8 +1262,8 @@ abstract class _DartdocArgOption<T> implements DartdocOption<T> {
void _onMissingFromArgs(
_OptionValueWithContext<Object> valueWithContext, String missingPath) {
throw DartdocFileMissing(
'Argument --${argName}, set to ${valueWithContext.value}, resolves to '
'missing path: "${missingPath}"');
'Argument --$argName, set to ${valueWithContext.value}, resolves to '
'missing path: "$missingPath"');
}

/// Generates an _OptionValueWithContext using the value of the argument from
Expand Down Expand Up @@ -1299,7 +1298,7 @@ abstract class _DartdocArgOption<T> implements DartdocOption<T> {
(retval as Map<String, String>)[pairList.first] = pairList.last;
}
} else {
throw UnsupportedError('Type ${T} is not supported');
throw UnsupportedError('Type $T is not supported');
}
return _OptionValueWithContext(retval, _directoryCurrentPath);
}
Expand All @@ -1319,7 +1318,7 @@ abstract class _DartdocArgOption<T> implements DartdocOption<T> {
argName = argName.replaceAllMapped(camelCaseRegexp, (Match m) {
var before = m.group(1);
var after = m.group(2).toLowerCase();
return '${before}-${after}';
return '$before-$after';
});
return argName;
}
Expand Down Expand Up @@ -1358,7 +1357,7 @@ abstract class _DartdocArgOption<T> implements DartdocOption<T> {
hide: hide,
splitCommas: splitCommas);
} else {
throw UnsupportedError('Type ${T} is not supported');
throw UnsupportedError('Type $T is not supported');
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/element_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class UndefinedElementType extends ElementType {
}

@override
String get nameWithGenerics => '$name${nullabilitySuffix}';
String get nameWithGenerics => '$name$nullabilitySuffix';

/// Assume that undefined elements don't have useful bounds.
@override
Expand Down Expand Up @@ -230,10 +230,10 @@ class TypeParameterElementType extends DefinedElementType {
TypeParameterType get type => super.type;

@override
String get linkedName => '${name}${nullabilitySuffix}';
String get linkedName => '$name$nullabilitySuffix';

@override
String get nameWithGenerics => '${name}${nullabilitySuffix}';
String get nameWithGenerics => '$name$nullabilitySuffix';

@override
DartType get _bound => type.bound;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/generator/dartdoc_generator_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ abstract class DartdocGeneratorBackend implements GeneratorBackend {
}
}

writer.write(_pathContext.join('categories.json'), '${json}\n');
writer.write(_pathContext.join('categories.json'), '$json\n');
}

@override
Expand All @@ -105,7 +105,7 @@ abstract class DartdocGeneratorBackend implements GeneratorBackend {
if (!options.useBaseHref) {
json = json.replaceAll(htmlBasePlaceholder, '');
}
writer.write(_pathContext.join('index.json'), '${json}\n');
writer.write(_pathContext.join('index.json'), '$json\n');
}

@override
Expand Down
10 changes: 5 additions & 5 deletions lib/src/generator/template_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class ConstructorTemplateData extends TemplateData<Constructor>
@override
String get metaDescription =>
'API docs for the ${constructor.name} constructor from the '
'${clazz} class from the ${library.name} library, '
'$clazz class from the ${library.name} library, '
'for the Dart programming language.';
}

Expand Down Expand Up @@ -398,15 +398,15 @@ class MethodTemplateData extends TemplateData<Method>
Method get self => method;
@override
String get title =>
'${method.name} method - ${container.name} ${containerDesc} - '
'${method.name} method - ${container.name} $containerDesc - '
'${library.name} library - Dart API';
@override
String get layoutTitle => _layoutTitle(
method.nameWithGenerics, method.fullkind, method.isDeprecated);
@override
String get metaDescription =>
'API docs for the ${method.name} method from the '
'${container.name} ${containerDesc}, for the Dart programming language.';
'${container.name} $containerDesc, for the Dart programming language.';
@override
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];
@override
Expand Down Expand Up @@ -440,15 +440,15 @@ class PropertyTemplateData extends TemplateData<Field>

@override
String get title =>
'${property.name} ${property.kind} - ${container.name} ${containerDesc} - '
'${property.name} ${property.kind} - ${container.name} $containerDesc - '
'${library.name} library - Dart API';
@override
String get layoutTitle =>
_layoutTitle(property.name, property.fullkind, property.isDeprecated);
@override
String get metaDescription =>
'API docs for the ${property.name} ${property.kind} from the '
'${container.name} ${containerDesc}, for the Dart programming language.';
'${container.name} $containerDesc, for the Dart programming language.';
@override
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];
@override
Expand Down
2 changes: 1 addition & 1 deletion lib/src/logging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void startLogging(LoggingContext config) {
// the backspace to occur for stderr as well.
stderr.write('${ansi.backspace} ${ansi.backspace}');
}
stderr.write('${message}\n');
stderr.writeln('$message');
}
writingProgress = false;
});
Expand Down
2 changes: 1 addition & 1 deletion lib/src/markdown_processor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ class _MarkdownCommentReference {

void _reducePreferReferencesIncludingFullyQualifiedName() {
var startName = '${element.fullyQualifiedName}.';
var realName = '${element.fullyQualifiedName}.${codeRefChomped}';
var realName = '${element.fullyQualifiedName}.$codeRefChomped';
if (results.any((r) => r.fullyQualifiedName == realName)) {
results.removeWhere((r) => r.fullyQualifiedName != realName);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/canonicalization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class ScoredCandidate implements Comparable<ScoredCandidate> {
score += scoreDelta;
if (scoreDelta != 0) {
_reasons.add(
"${reason} (${scoreDelta >= 0 ? '+' : ''}${scoreDelta.toStringAsPrecision(4)})");
"$reason (${scoreDelta >= 0 ? '+' : ''}${scoreDelta.toStringAsPrecision(4)})");
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class Class extends Container
false,
'Can not handle intermediate non-public interfaces '
'created by ModelElements that are not classes or mixins: '
'${fullyQualifiedName} contains an interface {$i}, '
'$fullyQualifiedName contains an interface {$i}, '
'defined by ${i.element}');
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/model/constructor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ class Constructor extends ModelElement
if (_nameWithGenerics == null) {
var constructorName = element.name;
if (constructorName.isEmpty) {
_nameWithGenerics = '${enclosingElement.name}${genericParameters}';
_nameWithGenerics = '${enclosingElement.name}$genericParameters';
} else {
_nameWithGenerics =
'${enclosingElement.name}${genericParameters}.$constructorName';
'${enclosingElement.name}$genericParameters.$constructorName';
}
}
return _nameWithGenerics;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/inheritable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mixin Inheritable on ContainerMember {
orElse: () => null);
}
if (canonicalEnclosingContainer != null) {
throw UnimplementedError('${canonicalEnclosingContainer}: unknown type');
throw UnimplementedError('$canonicalEnclosingContainer: unknown type');
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class Package extends LibraryContainer

if (documentedWhere == DocumentLocation.remote) {
_baseHref = _remoteBaseHref;
if (!_baseHref.endsWith('/')) _baseHref = '${_baseHref}/';
if (!_baseHref.endsWith('/')) _baseHref = '$_baseHref/';
} else {
_baseHref = config.useBaseHref ? '' : htmlBasePlaceholder;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/model/package_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class PubPackageBuilder implements PackageBuilder {
}
_addKnownFiles(r.element);
if (!libraries.contains(r.element) && isLibraryIncluded(r.element)) {
logDebug('parsing ${f}...');
logDebug('parsing $f...');
libraryAdder(r);
libraries.add(r.element);
}
Expand Down Expand Up @@ -273,8 +273,8 @@ class PubPackageBuilder implements PackageBuilder {
for (var lib
in _listDir(packageDir, recursive: true, listDir: _packageDirList)) {
if (lib.endsWith('.dart') &&
(!lib.contains('${sep}packages${sep}') ||
packageDir.contains('${sep}packages${sep}'))) {
(!lib.contains('${sep}packages$sep') ||
packageDir.contains('${sep}packages$sep'))) {
// Only include libraries within the lib dir that are not in 'lib/src'.
if (_pathContext.isWithin(packageLibDir, lib) &&
!_pathContext.isWithin(packageLibSrcDir, lib)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/package_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ class PackageGraph {
warnOnElement(
null, PackageWarning.packageOrderGivesMissingPackageName,
message:
"${packageName}, packages: ${packages.map((p) => p.name).join(',')}");
"$packageName, packages: ${packages.map((p) => p.name).join(',')}");
}
}
_publicPackages = packages.where((p) => p.isPublic).toList()..sort();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/model/parameter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class Parameter extends ModelElement implements EnclosedElement {
if (enclosingName != null && enclosingName.isNotEmpty) break;
}
}
return '${enclosingName}-param-${name}';
return '$enclosingName-param-$name';
} else {
return 'param-${name}';
return 'param-$name';
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/render/model_element_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ModelElementRendererHtml extends ModelElementRenderer {
@override
String renderLinkedName(ModelElement modelElement) {
var cssClass = modelElement.isDeprecated ? ' class="deprecated"' : '';
return '<a${cssClass} href="${modelElement.href}">${modelElement.name}</a>';
return '<a$cssClass href="${modelElement.href}">${modelElement.name}</a>';
}

@override
Expand Down Expand Up @@ -61,7 +61,7 @@ class ModelElementRendererHtml extends ModelElementRenderer {
return '''
<div style="position: relative;">
<div id="${overlayId}"
<div id="$overlayId"
onclick="var $uniqueId = document.getElementById('$uniqueId');
if ($uniqueId.paused) {
$uniqueId.play();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/render/parameter_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ParameterRendererHtmlList extends ParameterRendererHtml {
/// Render HTML suitable for a single, wrapped line.
class ParameterRendererHtml extends ParameterRenderer {
@override
String listItem(String listItem) => '${listItem}';
String listItem(String listItem) => listItem;
@override
String orderedList(String listItems) => listItems;
@override
Expand All @@ -38,7 +38,7 @@ class ParameterRendererHtml extends ParameterRenderer {

@override
String parameter(String parameter, String htmlId) =>
'<span class="parameter" id="${htmlId}">$parameter</span>';
'<span class="parameter" id="$htmlId">$parameter</span>';
@override
String parameterName(String parameterName) =>
'<span class="parameter-name">$parameterName</span>';
Expand Down
Loading

0 comments on commit 75a3c1e

Please sign in to comment.