Skip to content

Commit 044754d

Browse files
authored
Update pedantic to newest version(1.11) (#2556)
* Update pedantic to newest version * Reformat
1 parent b3ffca1 commit 044754d

29 files changed

+86
-88
lines changed

analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Change analysis_options.yaml and analysis_options_presubmit.yaml
22
# together.
3-
include: package:pedantic/analysis_options.1.9.0.yaml
3+
include: package:pedantic/analysis_options.1.11.0.yaml
44

55
analyzer:
66
errors:

analysis_options_presubmit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Change analysis_options.yaml and analysis_options_presubmit.yaml
22
# together.
3-
include: package:pedantic/analysis_options.1.9.0.yaml
3+
include: package:pedantic/analysis_options.1.11.0.yaml
44

55
analyzer:
66
errors:

lib/dartdoc.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class DartdocFileWriter implements FileWriter {
6868
if (!allowOverwrite) {
6969
if (_fileElementMap.containsKey(outFile)) {
7070
assert(element != null,
71-
'Attempted overwrite of ${outFile} without corresponding element');
71+
'Attempted overwrite of $outFile without corresponding element');
7272
var originalElement = _fileElementMap[outFile];
7373
Iterable<Warnable> referredFrom =
7474
originalElement != null ? [originalElement] : null;
@@ -183,7 +183,7 @@ class Dartdoc {
183183
packageGraph = await packageBuilder.buildPackageGraph();
184184
seconds = _stopwatch.elapsedMilliseconds / 1000.0;
185185
var libs = packageGraph.libraries.length;
186-
logInfo("Initialized dartdoc with ${libs} librar${libs == 1 ? 'y' : 'ies'} "
186+
logInfo("Initialized dartdoc with $libs librar${libs == 1 ? 'y' : 'ies'} "
187187
'in ${seconds.toStringAsFixed(1)} seconds');
188188
_stopwatch.reset();
189189

@@ -206,13 +206,13 @@ class Dartdoc {
206206
if (warnings == 0 && errors == 0) {
207207
logInfo('no issues found');
208208
} else {
209-
logWarning("Found ${warnings} ${pluralize('warning', warnings)} "
210-
"and ${errors} ${pluralize('error', errors)}.");
209+
logWarning("Found $warnings ${pluralize('warning', warnings)} "
210+
"and $errors ${pluralize('error', errors)}.");
211211
}
212212

213213
seconds = _stopwatch.elapsedMilliseconds / 1000.0;
214214
libs = packageGraph.localPublicLibraries.length;
215-
logInfo("Documented ${libs} public librar${libs == 1 ? 'y' : 'ies'} "
215+
logInfo("Documented $libs public librar${libs == 1 ? 'y' : 'ies'} "
216216
'in ${seconds.toStringAsFixed(1)} seconds');
217217
return DartdocResults(config.topLevelPackageMeta, packageGraph, outputDir);
218218
}
@@ -489,10 +489,10 @@ class Dartdoc {
489489
},
490490
(e, chain) {
491491
if (e is DartdocFailure) {
492-
stderr.writeln('\ndartdoc failed: ${e}.');
492+
stderr.writeln('\ndartdoc failed: $e.');
493493
exitCode = 1;
494494
} else {
495-
stderr.writeln('\ndartdoc failed: ${e}\n${chain}');
495+
stderr.writeln('\ndartdoc failed: $e\n$chain');
496496
exitCode = 255;
497497
}
498498
},

lib/options.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,5 @@ void _printUsage(ArgParser parser) {
9999

100100
/// Print version information.
101101
void _printVersion(ArgParser parser) {
102-
print('dartdoc version: ${dartdocVersion}');
102+
print('dartdoc version: $dartdocVersion');
103103
}

lib/src/dartdoc_options.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class CategoryConfiguration {
100100
.join(canonicalYamlPath, documentationMarkdown));
101101
if (!resourceProvider.getFile(documentationMarkdown).exists) {
102102
throw DartdocFileMissing(
103-
'In categories definition for ${name}, "markdown" resolves to '
103+
'In categories definition for $name, "markdown" resolves to '
104104
'the missing file $documentationMarkdown');
105105
}
106106
}
@@ -860,10 +860,10 @@ abstract class DartdocSyntheticOption<T> implements DartdocOption<T> {
860860

861861
void _onMissingFromSynthetic(
862862
_OptionValueWithContext<Object> valueWithContext, String missingPath) {
863-
var description = 'Synthetic configuration option ${name} from <internal>';
863+
var description = 'Synthetic configuration option $name from <internal>';
864864
throw DartdocFileMissing(
865865
'$description, computed as ${valueWithContext.value}, resolves to '
866-
'missing path: "${missingPath}"');
866+
'missing path: "$missingPath"');
867867
}
868868
}
869869

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

10701069
@override
@@ -1174,7 +1173,7 @@ abstract class _DartdocFileOption<T> implements DartdocOption<T> {
11741173
returnData = yamlData;
11751174
}
11761175
} else {
1177-
throw UnsupportedError('Type ${T} is not supported');
1176+
throw UnsupportedError('Type $T is not supported');
11781177
}
11791178
return _OptionValueWithContext(returnData as T, contextPath,
11801179
definingFile: 'dartdoc_options.yaml');
@@ -1245,8 +1244,8 @@ abstract class _DartdocArgOption<T> implements DartdocOption<T> {
12451244
example = '0.76';
12461245
}
12471246
throw DartdocOptionError(
1248-
'Invalid argument value: --${argName}, set to "${value}", must be a '
1249-
'${T}. Example: --${argName} ${example}');
1247+
'Invalid argument value: --$argName, set to "$value", must be a '
1248+
'$T. Example: --$argName $example');
12501249
}
12511250

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

12701269
/// Generates an _OptionValueWithContext using the value of the argument from
@@ -1299,7 +1298,7 @@ abstract class _DartdocArgOption<T> implements DartdocOption<T> {
12991298
(retval as Map<String, String>)[pairList.first] = pairList.last;
13001299
}
13011300
} else {
1302-
throw UnsupportedError('Type ${T} is not supported');
1301+
throw UnsupportedError('Type $T is not supported');
13031302
}
13041303
return _OptionValueWithContext(retval, _directoryCurrentPath);
13051304
}
@@ -1319,7 +1318,7 @@ abstract class _DartdocArgOption<T> implements DartdocOption<T> {
13191318
argName = argName.replaceAllMapped(camelCaseRegexp, (Match m) {
13201319
var before = m.group(1);
13211320
var after = m.group(2).toLowerCase();
1322-
return '${before}-${after}';
1321+
return '$before-$after';
13231322
});
13241323
return argName;
13251324
}
@@ -1358,7 +1357,7 @@ abstract class _DartdocArgOption<T> implements DartdocOption<T> {
13581357
hide: hide,
13591358
splitCommas: splitCommas);
13601359
} else {
1361-
throw UnsupportedError('Type ${T} is not supported');
1360+
throw UnsupportedError('Type $T is not supported');
13621361
}
13631362
}
13641363
}

lib/src/element_type.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class UndefinedElementType extends ElementType {
136136
}
137137

138138
@override
139-
String get nameWithGenerics => '$name${nullabilitySuffix}';
139+
String get nameWithGenerics => '$name$nullabilitySuffix';
140140

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

232232
@override
233-
String get linkedName => '${name}${nullabilitySuffix}';
233+
String get linkedName => '$name$nullabilitySuffix';
234234

235235
@override
236-
String get nameWithGenerics => '${name}${nullabilitySuffix}';
236+
String get nameWithGenerics => '$name$nullabilitySuffix';
237237

238238
@override
239239
DartType get _bound => type.bound;

lib/src/generator/dartdoc_generator_backend.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ abstract class DartdocGeneratorBackend implements GeneratorBackend {
9595
}
9696
}
9797

98-
writer.write(_pathContext.join('categories.json'), '${json}\n');
98+
writer.write(_pathContext.join('categories.json'), '$json\n');
9999
}
100100

101101
@override
@@ -105,7 +105,7 @@ abstract class DartdocGeneratorBackend implements GeneratorBackend {
105105
if (!options.useBaseHref) {
106106
json = json.replaceAll(htmlBasePlaceholder, '');
107107
}
108-
writer.write(_pathContext.join('index.json'), '${json}\n');
108+
writer.write(_pathContext.join('index.json'), '$json\n');
109109
}
110110

111111
@override

lib/src/generator/template_data.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ class ConstructorTemplateData extends TemplateData<Constructor>
322322
@override
323323
String get metaDescription =>
324324
'API docs for the ${constructor.name} constructor from the '
325-
'${clazz} class from the ${library.name} library, '
325+
'$clazz class from the ${library.name} library, '
326326
'for the Dart programming language.';
327327
}
328328

@@ -398,15 +398,15 @@ class MethodTemplateData extends TemplateData<Method>
398398
Method get self => method;
399399
@override
400400
String get title =>
401-
'${method.name} method - ${container.name} ${containerDesc} - '
401+
'${method.name} method - ${container.name} $containerDesc - '
402402
'${library.name} library - Dart API';
403403
@override
404404
String get layoutTitle => _layoutTitle(
405405
method.nameWithGenerics, method.fullkind, method.isDeprecated);
406406
@override
407407
String get metaDescription =>
408408
'API docs for the ${method.name} method from the '
409-
'${container.name} ${containerDesc}, for the Dart programming language.';
409+
'${container.name} $containerDesc, for the Dart programming language.';
410410
@override
411411
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];
412412
@override
@@ -440,15 +440,15 @@ class PropertyTemplateData extends TemplateData<Field>
440440

441441
@override
442442
String get title =>
443-
'${property.name} ${property.kind} - ${container.name} ${containerDesc} - '
443+
'${property.name} ${property.kind} - ${container.name} $containerDesc - '
444444
'${library.name} library - Dart API';
445445
@override
446446
String get layoutTitle =>
447447
_layoutTitle(property.name, property.fullkind, property.isDeprecated);
448448
@override
449449
String get metaDescription =>
450450
'API docs for the ${property.name} ${property.kind} from the '
451-
'${container.name} ${containerDesc}, for the Dart programming language.';
451+
'${container.name} $containerDesc, for the Dart programming language.';
452452
@override
453453
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];
454454
@override

lib/src/logging.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void startLogging(LoggingContext config) {
118118
// the backspace to occur for stderr as well.
119119
stderr.write('${ansi.backspace} ${ansi.backspace}');
120120
}
121-
stderr.write('${message}\n');
121+
stderr.writeln('$message');
122122
}
123123
writingProgress = false;
124124
});

lib/src/markdown_processor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ class _MarkdownCommentReference {
516516

517517
void _reducePreferReferencesIncludingFullyQualifiedName() {
518518
var startName = '${element.fullyQualifiedName}.';
519-
var realName = '${element.fullyQualifiedName}.${codeRefChomped}';
519+
var realName = '${element.fullyQualifiedName}.$codeRefChomped';
520520
if (results.any((r) => r.fullyQualifiedName == realName)) {
521521
results.removeWhere((r) => r.fullyQualifiedName != realName);
522522
}

lib/src/model/canonicalization.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class ScoredCandidate implements Comparable<ScoredCandidate> {
107107
score += scoreDelta;
108108
if (scoreDelta != 0) {
109109
_reasons.add(
110-
"${reason} (${scoreDelta >= 0 ? '+' : ''}${scoreDelta.toStringAsPrecision(4)})");
110+
"$reason (${scoreDelta >= 0 ? '+' : ''}${scoreDelta.toStringAsPrecision(4)})");
111111
}
112112
}
113113

lib/src/model/class.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class Class extends Container
295295
false,
296296
'Can not handle intermediate non-public interfaces '
297297
'created by ModelElements that are not classes or mixins: '
298-
'${fullyQualifiedName} contains an interface {$i}, '
298+
'$fullyQualifiedName contains an interface {$i}, '
299299
'defined by ${i.element}');
300300
continue;
301301
}

lib/src/model/constructor.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ class Constructor extends ModelElement
100100
if (_nameWithGenerics == null) {
101101
var constructorName = element.name;
102102
if (constructorName.isEmpty) {
103-
_nameWithGenerics = '${enclosingElement.name}${genericParameters}';
103+
_nameWithGenerics = '${enclosingElement.name}$genericParameters';
104104
} else {
105105
_nameWithGenerics =
106-
'${enclosingElement.name}${genericParameters}.$constructorName';
106+
'${enclosingElement.name}$genericParameters.$constructorName';
107107
}
108108
}
109109
return _nameWithGenerics;

lib/src/model/inheritable.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ mixin Inheritable on ContainerMember {
5454
orElse: () => null);
5555
}
5656
if (canonicalEnclosingContainer != null) {
57-
throw UnimplementedError('${canonicalEnclosingContainer}: unknown type');
57+
throw UnimplementedError('$canonicalEnclosingContainer: unknown type');
5858
}
5959
return null;
6060
}

lib/src/model/package.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class Package extends LibraryContainer
243243

244244
if (documentedWhere == DocumentLocation.remote) {
245245
_baseHref = _remoteBaseHref;
246-
if (!_baseHref.endsWith('/')) _baseHref = '${_baseHref}/';
246+
if (!_baseHref.endsWith('/')) _baseHref = '$_baseHref/';
247247
} else {
248248
_baseHref = config.useBaseHref ? '' : htmlBasePlaceholder;
249249
}

lib/src/model/package_builder.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class PubPackageBuilder implements PackageBuilder {
218218
}
219219
_addKnownFiles(r.element);
220220
if (!libraries.contains(r.element) && isLibraryIncluded(r.element)) {
221-
logDebug('parsing ${f}...');
221+
logDebug('parsing $f...');
222222
libraryAdder(r);
223223
libraries.add(r.element);
224224
}
@@ -273,8 +273,8 @@ class PubPackageBuilder implements PackageBuilder {
273273
for (var lib
274274
in _listDir(packageDir, recursive: true, listDir: _packageDirList)) {
275275
if (lib.endsWith('.dart') &&
276-
(!lib.contains('${sep}packages${sep}') ||
277-
packageDir.contains('${sep}packages${sep}'))) {
276+
(!lib.contains('${sep}packages$sep') ||
277+
packageDir.contains('${sep}packages$sep'))) {
278278
// Only include libraries within the lib dir that are not in 'lib/src'.
279279
if (_pathContext.isWithin(packageLibDir, lib) &&
280280
!_pathContext.isWithin(packageLibSrcDir, lib)) {

lib/src/model/package_graph.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ class PackageGraph {
501501
warnOnElement(
502502
null, PackageWarning.packageOrderGivesMissingPackageName,
503503
message:
504-
"${packageName}, packages: ${packages.map((p) => p.name).join(',')}");
504+
"$packageName, packages: ${packages.map((p) => p.name).join(',')}");
505505
}
506506
}
507507
_publicPackages = packages.where((p) => p.isPublic).toList()..sort();

lib/src/model/parameter.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ class Parameter extends ModelElement implements EnclosedElement {
5252
if (enclosingName != null && enclosingName.isNotEmpty) break;
5353
}
5454
}
55-
return '${enclosingName}-param-${name}';
55+
return '$enclosingName-param-$name';
5656
} else {
57-
return 'param-${name}';
57+
return 'param-$name';
5858
}
5959
}
6060

lib/src/render/model_element_renderer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ModelElementRendererHtml extends ModelElementRenderer {
1919
@override
2020
String renderLinkedName(ModelElement modelElement) {
2121
var cssClass = modelElement.isDeprecated ? ' class="deprecated"' : '';
22-
return '<a${cssClass} href="${modelElement.href}">${modelElement.name}</a>';
22+
return '<a$cssClass href="${modelElement.href}">${modelElement.name}</a>';
2323
}
2424

2525
@override
@@ -61,7 +61,7 @@ class ModelElementRendererHtml extends ModelElementRenderer {
6161
return '''
6262
6363
<div style="position: relative;">
64-
<div id="${overlayId}"
64+
<div id="$overlayId"
6565
onclick="var $uniqueId = document.getElementById('$uniqueId');
6666
if ($uniqueId.paused) {
6767
$uniqueId.play();

lib/src/render/parameter_renderer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ParameterRendererHtmlList extends ParameterRendererHtml {
2222
/// Render HTML suitable for a single, wrapped line.
2323
class ParameterRendererHtml extends ParameterRenderer {
2424
@override
25-
String listItem(String listItem) => '${listItem}';
25+
String listItem(String listItem) => listItem;
2626
@override
2727
String orderedList(String listItems) => listItems;
2828
@override
@@ -38,7 +38,7 @@ class ParameterRendererHtml extends ParameterRenderer {
3838

3939
@override
4040
String parameter(String parameter, String htmlId) =>
41-
'<span class="parameter" id="${htmlId}">$parameter</span>';
41+
'<span class="parameter" id="$htmlId">$parameter</span>';
4242
@override
4343
String parameterName(String parameterName) =>
4444
'<span class="parameter-name">$parameterName</span>';

0 commit comments

Comments
 (0)