OLD | NEW |
| (Empty) |
1 # dartanalyzer | |
2 | |
3 Use _dartanalyzer_ to statically analyze your code at the command line, | |
4 checking for errors and warnings that are specified in the | |
5 [Dart Language Specification](https://www.dartlang.org/docs/spec/). | |
6 DartPad, code editors, and IDEs such as WebStorm use the same | |
7 analysis engine that dartanalyzer uses. | |
8 | |
9 If you want to _contribute_ to the dartanalyzer project, see the | |
10 [contributor docs](https://github.com/dart-lang/analyzer_cli/blob/master/CONTRIB
UTOR.md). | |
11 This page contains information about _using_ the dartanalyzer command-line tool. | |
12 | |
13 ## Basic usage | |
14 | |
15 Run the analyzer from the top directory of the package. | |
16 Here's an example of testing a Dart file. | |
17 | |
18 ``` | |
19 dartanalyzer bin/test.dart | |
20 ``` | |
21 | |
22 ## Options | |
23 | |
24 The following are the most commonly used options for dartanalyzer: | |
25 | |
26 * `--packages=`<br> | |
27 Specify the path to the package resolution configuration file. | |
28 For more information see | |
29 [Package Resolution Configuration File](https://github.com/lrhn/dep-pkgspec/blo
b/master/DEP-pkgspec.md). | |
30 This option cannot be used with `--package-root`. | |
31 | |
32 * `--package-warnings`<br> | |
33 Show warnings not only for code in the specified .dart file and | |
34 others in its library, but also for libraries imported with `package:`. | |
35 | |
36 * `--options=`<br> | |
37 Specify the path to an analysis options file. | |
38 | |
39 * `--lints`<br> | |
40 Show the results from the linter. | |
41 | |
42 * `--no-hints`<br> | |
43 Don't show hints for improving the code. | |
44 | |
45 * `--ignore-unrecognized-flags`<br> | |
46 Rather than printing the help message, | |
47 ignore any unrecognized command-line flags. | |
48 | |
49 * `--version`<br> | |
50 Show the analyzer version. | |
51 | |
52 * `-h` _or_ `--help`<br> | |
53 Show all the command-line options. | |
54 | |
55 The following are advanced options to use with dartanalyzer: | |
56 | |
57 * `-b` _or_ `--batch`<br> | |
58 Run in batch mode. | |
59 | |
60 * `--dart-sdk=`<br> | |
61 Specify the directory that contains the Dart SDK. | |
62 | |
63 * `--fatal-warnings`<br> | |
64 Except for type warnings, treat warnings as fatal. | |
65 | |
66 * `--format=machine`<br> | |
67 Produce output in a format suitable for parsing. | |
68 | |
69 * `--url-mapping=libraryUri,/path/to/library.dart`<br> | |
70 Tells the analyzer to use the specified library as the source | |
71 for that particular import. | |
72 | |
73 The following options are deprecated: | |
74 | |
75 * `-p` _or_ `--package-root=`<br> | |
76 **Deprecated.** Specify the directory to search for any libraries that are | |
77 imported using `package:`. _This option is replaced as of Dart 1.12 with | |
78 `--packages`._ | |
79 | |
80 * `--machine`<br> | |
81 **Deprecated.** Replaced by `--format`. | |
82 | |
83 * `--show-package-warnings`<br> | |
84 **Deprecated.** Replaced by `--package-warnings`. | |
85 | |
86 * `--show-sdk-warnings`<br> | |
87 **Deprecated.** Replaced by `--warnings`. | |
OLD | NEW |