Skip to content

The dart analyze tool doesn't work on stand-alone scripts. #46109

@lrhn

Description

@lrhn

Given the plan to discontinue the stand-alone dartanalyzer command (#46100), the dart analyze command should have feature parity before that happens.

It's currently not possible to analyze a stand-alone file using dart analyze. For a random file I had lying around:

> dart analyze mirext.dart
Directory doesn't exist: mirext.dart

Usage: dart analyze [arguments] [<directory>]
-h, --help                   Print this usage information.
    --fatal-infos            Treat info level issues as fatal.
    --[no-]fatal-warnings    Treat warning level issues as fatal.
                             (defaults to on)

Run "dart help" to see global options.

vs

> dartanalyzer mirext.dart
Analyzing mirext.dart...
  error - A value of type 'TypeMirror' can't be assigned to a variable of type 'ClassMirror'. - mirext.dart:12:19 - invalid_assignment
  error - A value of type 'DeclarationMirror?' can't be assigned to a variable of type 'LibraryMirror'. - mirext.dart:16:21 - invalid_assignment
2 errors found.

(I can do dart analyze ., and if the file is the only one in the directory, it works, but if it's not, it's a lot of unnecessary overhead to analyze and filter through the rest).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.dart-cli-analyzeIssues related to the 'dart analyze' tool

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions