-
Notifications
You must be signed in to change notification settings - Fork 656
test(rome_js_formatter): support report prettier metric as a json file #2626
test(rome_js_formatter): support report prettier metric as a json file #2626
Conversation
Could you add few lines in the description of the PR about:
|
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! I agree that it makes sense to have a json option so that changes can be compared more easily in CI.
Currently, this PR duplicates a lot of the report calculations, which makes it more likely to fall out of sync if we modify our metrics in the future. Could you extract those calculations so that the report_json
and report_markdown
methods are only directly responsible for the differences that are specific to that report type?
Maybe there could be a method that produces a PrettierReport
that the individual report_X
methods know how to print into different formats?
agree |
We could also update the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with Yasser. I think it would be good to factor out the computation into a helper function that returns the numbers and the markdown/json functions only print the results differently.
I have refactored the code, I think I am ready for reviewing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing the refactor. That should help us to keep the implementations in sync in the future.
I've a small comment that may help to reduce some code. Let me know if you want to address it before merging or prefer to keep it as is.
Summary
part of #2555
To achieve printing diff between
main
branch and pull request branch, a few steps we need to do list belowprettier compatibility metric
onmain
branchpull request branch
prettier compatibility metric
onpull request
branchObviously,
Markdown
is not a good format for comparing, so we need to add an extra format to save metrics, which isJson
just like
Parser conformance
This pull request introduces these two changes:
json
ormarkdown
format.Test Plan
No need to test