Skip to content

Commit a1c7ce3

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: simplify parseConfig function
The parameter was unnecessarily nullable. Making it non-nullable simplifies some things. Change-Id: I6f08ecb9e0700db31182327394e50dd23e89f86f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389022 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Keerti Parthasarathy <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent 368cb64 commit a1c7ce3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

pkg/analyzer/lib/src/lint/config.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
import 'package:analyzer/src/util/yaml.dart';
66
import 'package:yaml/yaml.dart';
77

8-
/// Parse the given map into a lint config.
9-
/// Return `null` if [optionsMap] is `null` or does not have `linter` map.
10-
LintConfig? parseConfig(YamlMap? optionsMap) {
11-
if (optionsMap != null) {
12-
var options = optionsMap.valueAt('linter');
13-
// Quick check of basic contract.
14-
if (options is YamlMap) {
15-
return LintConfig.parseMap(options);
16-
}
8+
/// Parses [optionsMap] into a [LintConfig], returning the config, or `null` if
9+
/// [optionsMap] does not have `linter` map.
10+
LintConfig? parseConfig(YamlMap optionsMap) {
11+
var options = optionsMap.valueAt('linter');
12+
// Quick check of basic contract.
13+
if (options is YamlMap) {
14+
return LintConfig.parseMap(options);
1715
}
16+
1817
return null;
1918
}
2019

0 commit comments

Comments
 (0)