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

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: tweaks 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
9 learn more about it, please look at the
10 [Analysis Server API Specification](http://htmlpreview.github.io/?https://github .com/dart-lang/sdk/blob/master/pkg/analysis_server/doc/api.html)
11 or contact the mailing list (see below).
12 6
13 The API's in this package are, quite frankly, a mess at the moment. They were 7 End-users should use the [dartanalyzer][analyzercli] command-line tool
8 to analyze their Dart code.
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.
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.
25
26 The `.analysis_options` file should live
27 at the root of your project (for example, 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 - test/_data/bad*.dart
41 - test/_brokendata/**
42 ```
43
44 Note that you can use globs, as defined by the [glob package][glob].
45
46 Here is an example file that enables the analyzer's [strong mode][strongmode]:
47
48 ```
49 analyzer:
50 strong-mode: true
51 ```
52
53 Here is an example file that enables two lint rules:
54
55 ```
56 linter:
57 rules:
58 - camel_case_types
59 - empty_constructor_bodies
60 ```
61
62 Check out all the available [Dart lint rules][lintrules].
63
64 You can combine the `analyzer` section and the `linter` section into a single
65 configuration. Here is an example:
66
67 ```
68 analyzer:
69 exclude:
70 - test/_data/p4/lib/lib1.dart
71 linter:
72 rules:
73 - camel_case_types
74 ```
75
76 ## Who uses this library?
77
78 Many tools embed this library, such as:
79
80 * dartfmt - a formatter for Dart code
81 * dartdoc - a documentation generator for Dart code
82 * Dart Analysis Server - a stateful server that supports IDEs and editors
83
84 ## Support
85
86 Questions and requests for additional functionality are welcome.
87 Please open an issue at
88 [http://dartbug.com](http://dartbug.com)
89 or by email
90 [analyzer-discuss@dartlang.org][list].
91
92 ## Background
93
94 The APIs 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 95 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 96 implementation. Several of the API's still look like their Java predecessors
16 (or worse) rather than clean Dart API's. 97 (or worse) rather than clean Dart API's.
17 98
18 In addition, there is currently no clean distinction between public and internal 99 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, 100 APIs. 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 101 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. 102 this causes for our clients, but some pain is inevitable.
22 103
23 Questions and requests for additional functionality are welcome, and can be made 104 ## License
24 by either opening an issue at 105
25 [http://dartbug.com](http://dartbug.com) 106 See the LICENSE file.
26 or by emailing 107
27 [analyzer-discuss@dartlang.org](https://groups.google.com/a/dartlang.org/forum/# !forum/analyzer-discuss). 108 [serverapi]: http://htmlpreview.github.io/?https://github.com/dart-lang/sdk/blob /master/pkg/analysis_server/doc/api.html
109 [analyzercli]: https://github.com/dart-lang/analyzer_cli
110 [list]: https://groups.google.com/a/dartlang.org/forum/#!forum/analyzer-discuss
111 [lintrules]: http://dart-lang.github.io/linter/lints/
112 [strongmode]: https://github.com/dart-lang/dev_compiler/blob/master/STRONG_MODE. md
113 [glob]: https://pub.dartlang.org/packages/glob
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