mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Revise dartanalyzer docs to indicate that it is not for general
consumption. Change-Id: Iec112f13ddeaa2fa43650bfc614ea786b2fff2bc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250768 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Auto-Submit: Janice Collins <jcollins@google.com>
This commit is contained in:
parent
b27709f1b8
commit
1c45191c89
|
@ -1,16 +0,0 @@
|
|||
# Changelog
|
||||
|
||||
## 1.1.1
|
||||
|
||||
- Removed outmoded `--url-mapping` command line option.
|
||||
|
||||
## 1.1.0
|
||||
|
||||
- New `--lints` command line option.
|
||||
|
||||
## 0.0.
|
||||
|
||||
|
||||
## 0.0.1
|
||||
|
||||
- Initial version
|
|
@ -1,79 +1,27 @@
|
|||
# dartanalyzer
|
||||
|
||||
Use _dartanalyzer_ to statically analyze your code at the command line,
|
||||
checking for errors and warnings that are specified in the
|
||||
[Dart Language Specification](https://dart.dev/guides/language/spec).
|
||||
DartPad, code editors, and IDEs such as Android Studio and VS Code
|
||||
use the same analysis engine that dartanalyzer uses.
|
||||
_dartanalyzer_ used to be the tool for statically analyzing dart code
|
||||
at the command line. However, this tool has been replaced with
|
||||
`dart analyze` for this purpose in current SDKs and will no longer
|
||||
be published on pub.
|
||||
|
||||
Do not depend on the command line interface or other semantics in
|
||||
this directory as it is now an internal tool for SDK development, used
|
||||
as the `dart2analyzer` "compiler" for `tools/test.py` in the SDK.
|
||||
It is configured as part of the test runner,
|
||||
[here](https://github.com/dart-lang/sdk/blob/main/pkg/test_runner/lib/src/compiler_configuration.dart).
|
||||
|
||||
## Basic usage
|
||||
|
||||
Run the analyzer from the top directory of the package.
|
||||
Here's an example of analyzing a Dart file.
|
||||
Run `dartanalyzer` from the test tool to validate analysis
|
||||
conclusions on language samples in the testing directory.
|
||||
From the root of the SDK:
|
||||
|
||||
```
|
||||
dartanalyzer bin/test.dart
|
||||
tools/test.py --build --use-sdk -c dart2analyzer co19_2 language_2
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
The following are the most commonly used options for dartanalyzer:
|
||||
|
||||
* `--packages=`
|
||||
|
||||
Specify the path to the package resolution configuration file.
|
||||
For more information see
|
||||
[Package Resolution Configuration File](https://github.com/lrhn/dep-pkgspec/blob/master/DEP-pkgspec.md).
|
||||
|
||||
* `--package-warnings`
|
||||
|
||||
Show warnings not only for code in the specified .dart file and
|
||||
others in its library, but also for libraries imported with `package:`.
|
||||
|
||||
* `--options=`
|
||||
|
||||
Specify the path to an analysis options file.
|
||||
|
||||
* `--[no-]lints`
|
||||
|
||||
Show the results from the linter.
|
||||
|
||||
* `--[no-]hints`
|
||||
|
||||
Don't show hints for improving the code.
|
||||
|
||||
* `--version`
|
||||
|
||||
Show the analyzer version.
|
||||
|
||||
* `-h` _or_ `--help`
|
||||
|
||||
Show all of the command-line options.
|
||||
|
||||
See the[Customizing static analysis
|
||||
guide](https://dart.dev/guides/language/analysis-options) for further ways to
|
||||
customize how dartanalyzer performs static analysis, and how it reports its
|
||||
findings.
|
||||
|
||||
The following are advanced options to use with dartanalyzer:
|
||||
|
||||
* `--dart-sdk=`
|
||||
|
||||
Specify the directory that contains the Dart SDK.
|
||||
|
||||
* `--fatal-warnings`
|
||||
|
||||
Except for type warnings, treat warnings as fatal.
|
||||
|
||||
* `--format=machine`
|
||||
|
||||
Produce output in a format suitable for parsing.
|
||||
|
||||
* `--ignore-unrecognized-flags`
|
||||
|
||||
Rather than printing the help message, ignore any unrecognized command-line
|
||||
flags.
|
||||
|
||||
* `--url-mapping=libraryUri,/path/to/library.dart`
|
||||
|
||||
Use the specified library as the source for that particular import.
|
||||
This will build the Dart VM and compile dartanalyzer into a snapshot, then use
|
||||
that snapshot while analyzing those directories under `testing/`. Without
|
||||
`--use-sdk`, test.py will use the source code version of `dartanalyzer`
|
||||
instead of the compiled one, which can be useful for debugging.
|
||||
|
|
Loading…
Reference in a new issue