Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: pkg/analyzer/README.md

Issue 1414133002: document analysis_options (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 The analysis package defines support for performing static analysis of Dart 1 # Analyzer for Dart
2 code. It was designed to support tooling efforts, but has also been used for
3 such things as statistics gathering and code transformers.
4 2
5 If you are interested in providing Dart support in a long-running tool, such as 3 This package provides a low-level _library_ that performs static analysis
6 an editor or IDE, you should use the analysis server instead of this package. 4 of Dart code. It is useful for tool
7 The analysis server is currently shipped as an executable in the SDK and will 5 integration and embedding.
8 be released as a package in the near future. In the meantime, if you'd like to 6
9 learn more about it, please look at the 7 End-users should use the [dartanalyzer][analyzercli] command-line tool
10 [Analysis Server API Specification](http://htmlpreview.github.io/?https://github .com/dart-lang/sdk/blob/master/pkg/analysis_server/doc/api.html) 8 to analyze their Dart code.
11 or contact the mailing list (see below). 9
10 Integrators that want to add Dart support to their editor
11 should use the _Dart Analysis Server_.
12 The [Analysis Server API Specification][serverapi] is available.
13 If you are adding Dart support to an editor or IDE, please let us know
14 by emailing our [list][].
15
16 ## Configuring the analyzer
17
18 Both the dartanalyzer and Dart Analysis Server can be configured
19 with a `.analysis_options` file. This YAML file can control which files
20 and paths are analyzed, which lints are applied, and more.
Brian Wilkerson 2015/10/20 00:16:41 Last I checked (a couple of days ago), lints were
sethladd 2015/10/20 18:32:15 Ah, interesting. How long until they are completed
Brian Wilkerson 2015/10/20 18:41:41 Currently targeted for 1.14.
21
22 If you are embedding the analyzer library in your project, you are
23 responsible for finding the `.analysis_options` file, parsing it,
24 and configuring the analyzer.
Brian Wilkerson 2015/10/20 00:16:41 There is at least one utility class that can help:
sethladd 2015/10/20 18:32:14 Where is that file? in this analyzer package?
Brian Wilkerson 2015/10/20 18:41:41 pkg/analyzer/lib/source/analysis_options_provider.
25
26 The `.analysis_options` file should live
27 at the root of your project (typically, next to your `pubspec.yaml`).
28 Different embedders of analyzer, such as dartanalyzer or Dart Analysis Server,
29 may choose to find the file in various different ways. Consult their
30 documentation to learn more.
31
32 Here is an example file that instructs the analyzer
33 to ignore two files:
34
35 ```
36 analyzer:
37 exclude:
38 - test/_data/p4/lib/lib1.dart
39 - test/_data/p5/p5.dart
40 ```
41
42 Here is an example file that enables the analyzer's _strong mode_:
43
44 ```
45 analyzer:
46 strong-mode: true
47 ```
48
49 Here is an example file that enables two lint rules:
Brian Wilkerson 2015/10/20 00:16:41 Again, I'd remove this (lines 49-70) for now.
50
51 ```
52 linter:
53 rules:
54 - camel_case_types
55 - empty_constructor_bodies
56 ```
57
58 Check out all the available [Dart lint rules][lintrules].
59
60 You can combine the `analyzer` section and the `linter` section into a single
61 configuration. Here is an example:
62
63 ```
64 analyzer:
65 exclude:
66 - test/_data/p4/lib/lib1.dart
67 linter:
68 rules:
69 - camel_case_types
70 ```
71
72 ## Who uses this library?
73
74 Many tools embed this library, such as:
75
76 * dartfmt - a formatter for Dart code
77 * dartdoc - a documentation generator for Dart code
78 * Dart Analysis Server - a stateful server that supports IDEs and editors
79
80 ## Support
81
82 Questions and requests for additional functionality are welcome.
83 Please open an issue at
84 [http://dartbug.com](http://dartbug.com)
85 or by email
86 [analyzer-discuss@dartlang.org][list].
87
88 ## Background
12 89
13 The API's in this package are, quite frankly, a mess at the moment. They were 90 The API's in this package are, quite frankly, a mess at the moment. They were
14 originally machine generated by a translator and were based on an earlier Java 91 originally machine generated by a translator and were based on an earlier Java
15 implementation. Several of the API's still look like their Java predecessors 92 implementation. Several of the API's still look like their Java predecessors
16 (or worse) rather than clean Dart API's. 93 (or worse) rather than clean Dart API's.
17 94
18 In addition, there is currently no clean distinction between public and internal 95 In addition, there is currently no clean distinction between public and internal
19 API's. We plan to address this issue soon, but doing so will, unfortunately, 96 API's. We plan to address this issue but doing so will, unfortunately,
20 require a large number of breaking changes. We will try to minimize the pain 97 require a large number of breaking changes. We will try to minimize the pain
21 this causes for our clients, but some pain is inevitable. 98 this causes for our clients, but some pain is inevitable.
22 99
23 Questions and requests for additional functionality are welcome, and can be made 100 ## License
24 by either opening an issue at 101
25 [http://dartbug.com](http://dartbug.com) 102 See the LICENSE file.
26 or by emailing 103
27 [analyzer-discuss@dartlang.org](https://groups.google.com/a/dartlang.org/forum/# !forum/analyzer-discuss). 104 [serverapi]: http://htmlpreview.github.io/?https://github.com/dart-lang/sdk/blob /master/pkg/analysis_server/doc/api.html
105 [analyzercli]: https://github.com/dart-lang/analyzer_cli
106 [list]: https://groups.google.com/a/dartlang.org/forum/#!forum/analyzer-discuss
107 [lintrules]: http://dart-lang.github.io/linter/lints/
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698