Files
sdk/pkg/analyzer_cli
David Morgan 79a5257155 Revert "Increase analyzer cache size to 512MB."
This reverts commit 0256155b7a.

Reason for revert: this change is obsolete; we now do caching outside the analyzer to make sure analyzer disk access is fast. So more likely we want to reduce the cache size to zero. Certainly, we don't want to increase it.

Original change's description:
> Increase analyzer cache size to 512MB.
> 
> I noticed earlier today that the cache looks to be to small for large internal apps, causing us to constantly reload summaries. This change fixes that, reducing build times significantly for large apps.
> 
> There is a larger issue here of the actual cache implementation though that should likely get resolved. We end up with several versions of each summary file in the cache until it fills up, so we will fill up the cache even on small apps today.
> 
> It is possible we should change how that works, instead of increasing this.
> 
> Fwiw, I see total ram consumption of almost exactly 1GB per worker after this change.
> 
> Change-Id: I0d8a06da72b86d44562819bc04f5ae5543610f0d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107360
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: David Morgan <davidmorgan@google.com>
> Commit-Queue: Jake Macdonald <jakemac@google.com>

TBR=scheglov@google.com,jakemac@google.com,davidmorgan@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: If00c0f9b8ee3fc177433df7c8d92731c2e5f0f9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108140
Reviewed-by: David Morgan <davidmorgan@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2019-07-08 08:39:50 +00:00
..
2017-02-10 12:47:06 -08:00
2018-10-25 14:19:31 +00:00

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. DartPad, code editors, and IDEs such as Android Studio and VS Code use the same analysis engine that dartanalyzer uses.

Basic usage

Run the analyzer from the top directory of the package. Here's an example of testing a Dart file.

dartanalyzer bin/test.dart

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. This option cannot be used with --package-root.

  • --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.

  • --lints
    Show the results from the linter.

  • --no-hints
    Don't show hints for improving the code.

  • --ignore-unrecognized-flags
    Rather than printing the help message, ignore any unrecognized command-line flags.

  • --version
    Show the analyzer version.

  • -h or --help
    Show all the command-line options.

The following are advanced options to use with dartanalyzer:

  • -b or --batch
    Run in batch mode.

  • --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.

  • --url-mapping=libraryUri,/path/to/library.dart
    Tells the analyzer to use the specified library as the source for that particular import.

The following options are deprecated:

  • --package-root=
    Deprecated. Specify the directory to search for any libraries that are imported using package:. This option is replaced as of Dart 1.12 with --packages.