| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:boolean_selector/boolean_selector.dart'; | 7 import 'package:boolean_selector/boolean_selector.dart'; |
| 8 import 'package:collection/collection.dart'; | 8 import 'package:collection/collection.dart'; |
| 9 import 'package:glob/glob.dart'; | 9 import 'package:glob/glob.dart'; |
| 10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 yield* presets.values; | 220 yield* presets.values; |
| 221 } | 221 } |
| 222 | 222 |
| 223 /// Parses the configuration from [args]. | 223 /// Parses the configuration from [args]. |
| 224 /// | 224 /// |
| 225 /// Throws a [FormatException] if [args] are invalid. | 225 /// Throws a [FormatException] if [args] are invalid. |
| 226 factory Configuration.parse(List<String> arguments) => args.parse(arguments); | 226 factory Configuration.parse(List<String> arguments) => args.parse(arguments); |
| 227 | 227 |
| 228 /// Loads the configuration from [path]. | 228 /// Loads the configuration from [path]. |
| 229 /// | 229 /// |
| 230 /// If [global] is `true`, this restricts the configuration file to only rules |
| 231 /// that are supported globally. |
| 232 /// |
| 230 /// Throws an [IOException] if [path] does not exist or cannot be read. Throws | 233 /// Throws an [IOException] if [path] does not exist or cannot be read. Throws |
| 231 /// a [FormatException] if its contents are invalid. | 234 /// a [FormatException] if its contents are invalid. |
| 232 factory Configuration.load(String path) => load(path); | 235 factory Configuration.load(String path, {bool global: false}) => |
| 236 load(path, global: global); |
| 233 | 237 |
| 234 factory Configuration({ | 238 factory Configuration({ |
| 235 bool help, | 239 bool help, |
| 236 bool version, | 240 bool version, |
| 237 bool verboseTrace, | 241 bool verboseTrace, |
| 238 bool jsTrace, | 242 bool jsTrace, |
| 239 bool skip, | 243 bool skip, |
| 240 String skipReason, | 244 String skipReason, |
| 241 PlatformSelector testOn, | 245 PlatformSelector testOn, |
| 242 bool pauseAfterLoad, | 246 bool pauseAfterLoad, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 506 |
| 503 /// Merges two maps whose values are [Configuration]s. | 507 /// Merges two maps whose values are [Configuration]s. |
| 504 /// | 508 /// |
| 505 /// Any overlapping keys in the maps have their configurations merged in the | 509 /// Any overlapping keys in the maps have their configurations merged in the |
| 506 /// returned map. | 510 /// returned map. |
| 507 Map<Object, Configuration> _mergeConfigMaps(Map<Object, Configuration> map1, | 511 Map<Object, Configuration> _mergeConfigMaps(Map<Object, Configuration> map1, |
| 508 Map<Object, Configuration> map2) => | 512 Map<Object, Configuration> map2) => |
| 509 mergeMaps(map1, map2, | 513 mergeMaps(map1, map2, |
| 510 value: (config1, config2) => config1.merge(config2)); | 514 value: (config1, config2) => config1.merge(config2)); |
| 511 } | 515 } |
| OLD | NEW |