-
Notifications
You must be signed in to change notification settings - Fork 266
[BUG] Gitlab reporter prints logs and JSON instead of JSON alone #1151
Comments
@pwa-tapptic can you provide |
@dkrutskikh it's actually printed as "Example bad JSON file" in my first message in What actually happened? section. |
@pwa-tapptic there are 2 options here: either hide progress indication if the reporter is not a console reporter or add an option of the output file name. Is the progress indication valuable to you to see or it can be omitted? |
@incendial IMO there is also a third option you may consider, namely using STDOUT to print JSON and STDERR to print progress (I believe that git and many other tools do this as well - they distinguish STDOUT and STDERR and print some messages, not necessarily errors onto STDERR). Given simple script echo "message to stdout"
1>&2 echo "msg to STDERR" when the script is ran $ ./script.sh > result.txt
msg to STDERR
$ cat result.txt
message to stdout |
Hmm, interesting suggestion, actually, thank you! |
Now I'm curious how many systems treat anything printed to stderr as an exit. So, this might introduce a breaking change |
@pwa-tapptic so a workaround would be to pass |
I can confirm that adding As for the stderr and exiting - it's something to be checked but AFAIK those are two separate things and play separate roles in "CLI app contract", so to speak. You may print plenty of stderr messages (even pure errors), but still exit with 0. You may also print nothing but exit with 1. There are some specific cases where you may have scripts that "listen to" stderr and perform actions based on this, but this is something that needs to be intentionally configured or implemented. Not sure if it could be somehow useful in Flutter and DCM case. |
What did you do? Please include the source code example causing the issue.
I run
flutter pub run dart_code_metrics:metrics lib --reporter=gitlab > gitlab.json
based on the documentation here.This issue is version-specific, looks like it does not depend on any specific configuration.
What did you expect to happen?
As it is demonstrated in the documentation I am supposed to get valid JSON report (
gitlab.json
) with Gitlab style when I usegitlab
reporter.What actually happened?
Versions tested:
Example bad JSON file:
Are you willing to submit a pull request to fix this bug?
Unfortunately no.
The text was updated successfully, but these errors were encountered: