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 library analyzer_cli.src.options; | 5 library analyzer_cli.src.options; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
10 import 'package:cli_util/cli_util.dart' show getSdkDir; | 10 import 'package:cli_util/cli_util.dart' show getSdkDir; |
(...skipping 30 matching lines...) Expand all Loading... |
41 /// "call" methods (fixes dartbug.com/21938). | 41 /// "call" methods (fixes dartbug.com/21938). |
42 final bool enableStrictCallChecks; | 42 final bool enableStrictCallChecks; |
43 | 43 |
44 /// Whether to relax restrictions on mixins (DEP 34). | 44 /// Whether to relax restrictions on mixins (DEP 34). |
45 final bool enableSuperMixins; | 45 final bool enableSuperMixins; |
46 | 46 |
47 /// Whether to treat type mismatches found during constant evaluation as | 47 /// Whether to treat type mismatches found during constant evaluation as |
48 /// errors. | 48 /// errors. |
49 final bool enableTypeChecks; | 49 final bool enableTypeChecks; |
50 | 50 |
| 51 /// Whether to treat hints as fatal |
| 52 final bool hintsAreFatal; |
| 53 |
51 /// Whether to ignore unrecognized flags | 54 /// Whether to ignore unrecognized flags |
52 final bool ignoreUnrecognizedFlags; | 55 final bool ignoreUnrecognizedFlags; |
53 | 56 |
54 /// Whether to report lints | 57 /// Whether to report lints |
55 final bool lints; | 58 final bool lints; |
56 | 59 |
57 /// Whether to log additional analysis messages and exceptions | 60 /// Whether to log additional analysis messages and exceptions |
58 final bool log; | 61 final bool log; |
59 | 62 |
60 /// Whether to use machine format for error display | 63 /// Whether to use machine format for error display |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 ArgResults args, Map<String, String> definedVariables) | 95 ArgResults args, Map<String, String> definedVariables) |
93 : dartSdkPath = args['dart-sdk'], | 96 : dartSdkPath = args['dart-sdk'], |
94 this.definedVariables = definedVariables, | 97 this.definedVariables = definedVariables, |
95 analysisOptionsFile = args['options'], | 98 analysisOptionsFile = args['options'], |
96 disableHints = args['no-hints'], | 99 disableHints = args['no-hints'], |
97 displayVersion = args['version'], | 100 displayVersion = args['version'], |
98 enableNullAwareOperators = args['enable-null-aware-operators'], | 101 enableNullAwareOperators = args['enable-null-aware-operators'], |
99 enableStrictCallChecks = args['enable-strict-call-checks'], | 102 enableStrictCallChecks = args['enable-strict-call-checks'], |
100 enableSuperMixins = args['supermixin'], | 103 enableSuperMixins = args['supermixin'], |
101 enableTypeChecks = args['enable_type_checks'], | 104 enableTypeChecks = args['enable_type_checks'], |
| 105 hintsAreFatal = args['fatal-hints'], |
102 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], | 106 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], |
103 lints = args['lints'], | 107 lints = args['lints'], |
104 log = args['log'], | 108 log = args['log'], |
105 machineFormat = args['machine'] || args['format'] == 'machine', | 109 machineFormat = args['machine'] || args['format'] == 'machine', |
106 packageConfigPath = args['packages'], | 110 packageConfigPath = args['packages'], |
107 packageRootPath = args['package-root'], | 111 packageRootPath = args['package-root'], |
108 shouldBatch = args['batch'], | 112 shouldBatch = args['batch'], |
109 showPackageWarnings = | 113 showPackageWarnings = |
110 args['show-package-warnings'] || args['package-warnings'], | 114 args['show-package-warnings'] || args['package-warnings'], |
111 showSdkWarnings = args['show-sdk-warnings'] || args['warnings'], | 115 showSdkWarnings = args['show-sdk-warnings'] || args['warnings'], |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ..addFlag('lints', | 206 ..addFlag('lints', |
203 help: 'Show lint results.', defaultsTo: false, negatable: false) | 207 help: 'Show lint results.', defaultsTo: false, negatable: false) |
204 ..addFlag('no-hints', | 208 ..addFlag('no-hints', |
205 help: 'Do not show hint results.', | 209 help: 'Do not show hint results.', |
206 defaultsTo: false, | 210 defaultsTo: false, |
207 negatable: false) | 211 negatable: false) |
208 ..addFlag('ignore-unrecognized-flags', | 212 ..addFlag('ignore-unrecognized-flags', |
209 help: 'Ignore unrecognized command line flags.', | 213 help: 'Ignore unrecognized command line flags.', |
210 defaultsTo: false, | 214 defaultsTo: false, |
211 negatable: false) | 215 negatable: false) |
| 216 ..addFlag('fatal-hints', |
| 217 help: 'Treat hints as fatal.', |
| 218 defaultsTo: false, |
| 219 negatable: false) |
212 ..addFlag('fatal-warnings', | 220 ..addFlag('fatal-warnings', |
213 help: 'Treat non-type warnings as fatal.', | 221 help: 'Treat non-type warnings as fatal.', |
214 defaultsTo: false, | 222 defaultsTo: false, |
215 negatable: false) | 223 negatable: false) |
216 ..addFlag('package-warnings', | 224 ..addFlag('package-warnings', |
217 help: 'Show warnings from package: imports.', | 225 help: 'Show warnings from package: imports.', |
218 defaultsTo: false, | 226 defaultsTo: false, |
219 negatable: false) | 227 negatable: false) |
220 ..addFlag('show-package-warnings', | 228 ..addFlag('show-package-warnings', |
221 help: 'Show warnings from package: imports (deprecated).', | 229 help: 'Show warnings from package: imports (deprecated).', |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 466 |
459 int _getNextFlagIndex(args, i) { | 467 int _getNextFlagIndex(args, i) { |
460 for (; i < args.length; ++i) { | 468 for (; i < args.length; ++i) { |
461 if (args[i].startsWith('--')) { | 469 if (args[i].startsWith('--')) { |
462 return i; | 470 return i; |
463 } | 471 } |
464 } | 472 } |
465 return i; | 473 return i; |
466 } | 474 } |
467 } | 475 } |
OLD | NEW |