--format=machine parameter for flutter analyze #95090
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
@christopherfujino
Use case
dart analyze
has a parameter--format
: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:It might therefore be considered advantageous if
flutter analyze
also had this feature for consistency. Note: There may be otherdart analyze
parameters that are not available forflutter 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:argParser.addOption('format', …
argResults['format']
and write the specified output formatWe need the same or almost the same code as
emitMachineFormat
andemitJsonFormat
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.The text was updated successfully, but these errors were encountered: