Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--format=machine parameter for flutter analyze #95090

Open
Tracked by #130635
twogood opened this issue Dec 11, 2021 · 0 comments
Open
Tracked by #130635

--format=machine parameter for flutter analyze #95090

twogood opened this issue Dec 11, 2021 · 0 comments
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter P2 Important issues not at the top of the work list team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team

Comments

@twogood
Copy link

twogood commented Dec 11, 2021

@christopherfujino

Use case

dart analyze has a parameter --format:

    --format=<value>         Specifies the format to display errors.

          [default]          The default output format. This format is intended to be user consumable.
                             The format is not specified and can change between releases.
          [json]             A machine readable output in a JSON format.
          [machine]          A machine readable output. The format is:

                             SEVERITY|TYPE|ERROR_CODE|FILE_PATH|LINE|COLUMN|LENGTH|ERROR_MESSAGE

                             Note that the pipe character is escaped with backslashes for the file path and error message fields.

The output from dart analyze --format=machine is supported by https://github.com/tomasbjerre/violation-comments-action so that it is possible to get analysis comments directly in PR diffs like this but with Dart code:
image

It might therefore be considered advantageous if flutter analyze also had this feature for consistency. Note: There may be other dart analyze parameters that are not available for flutter analyze but those are not part of this feature request.

Proposal

I propose the implementation of flutter analyze --format=…. The means would mean changing at least:

We need the same or almost the same code as emitMachineFormat and emitJsonFormat from https://github.com/dart-lang/sdk/blob/main/pkg/dartdev/lib/src/commands/analyze.dart and I suggest we just copy that code and modify as needed. In the name of reuse, it might be considered to introduce a pub.dev package but I personally believe that copying code is a better option in this case.

@danagbemava-nc danagbemava-nc added in triage Presently being triaged by the triage team passed first triage c: proposal A detailed proposal for a change to Flutter c: new feature Nothing broken; request for a new capability tool Affects the "flutter" command-line tool. See also t: labels. and removed in triage Presently being triaged by the triage team labels Dec 13, 2021
@flutter-triage-bot flutter-triage-bot bot added the team-tool Owned by Flutter Tool team label Jul 8, 2023
@christopherfujino christopherfujino added P2 Important issues not at the top of the work list triaged-tool Triaged by Flutter Tool team labels Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter P2 Important issues not at the top of the work list team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team
Projects
None yet
Development

No branches or pull requests

4 participants