Skip to content

Commit 0448e5f

Browse files
authored
Add type as parameter lint and fix problems (#2195)
1 parent bd21fdb commit 0448e5f

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ linter:
1717
- always_declare_return_types
1818
- annotate_overrides
1919
- avoid_init_to_null
20+
- avoid_types_as_parameter_names
2021
- directives_ordering
2122
- no_adjacent_strings_in_list
2223
- package_api_docs

lib/dartdoc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class Dartdoc extends PackageBuilder {
388388
Uri uri;
389389
try {
390390
uri = Uri.parse(href);
391-
} catch (FormatError) {
391+
} on FormatException {
392392
// ignore
393393
}
394394

lib/src/model/package_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ class PackageWithoutSdkResolver extends UriResolver {
458458
Uri resolved;
459459
try {
460460
resolved = _sdkResolver.restoreAbsolute(source);
461-
} catch (ArgumentError) {
461+
} on ArgumentError {
462462
// SDK resolvers really don't like being thrown package paths.
463463
}
464464
if (resolved == null) {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dev_dependencies:
4040
io: ^0.3.0
4141
http: ^0.12.0
4242
meta: ^1.0.0
43-
pedantic: ^1.8.0
43+
pedantic: ^1.9.0
4444
test: ^1.3.0
4545

4646
executables:

test/src/utils.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,11 @@ class SubprocessLauncher {
308308
Map result;
309309
try {
310310
result = json.decoder.convert(line);
311-
} catch (FormatException) {
312-
// ignore
311+
} on FormatException {
312+
// Assume invalid JSON is actually a line of normal text.
313+
} on TypeError {
314+
// The convert function returns a String if there is no JSON in the
315+
// line. Just ignore it and leave result null.
313316
}
314317
if (result != null) {
315318
if (jsonObjects == null) {

0 commit comments

Comments
 (0)