r-lib / styler

Non-invasive pretty printing of R code
https://styler.r-lib.org
Other
703 stars 70 forks source link

Reconsider storing code tree structure for tests by default #1206

Closed IndrajeetPatil closed 2 months ago

IndrajeetPatil commented 2 months ago

That is, consider whether setting write_tree = FALSE in test_collection(), and maybe turn it on to TRUE only in interactive contexts where these structures might help debug some issue?

The current approach tends to produce large git diffs for even minor changes in test code.

Is there any downside to doing so?

lorenzwalthert commented 2 months ago

Taking a closer look at the diff, many seem unrelated to your changes, and more related to some changes in {data.tree} or the parser itself.

Screenshot 2024-05-13 at 10 03 32

I have hardly ever used these tree files in practice. And they are also .Rbuildignored. I think people can generate them if they need, as you said, so we could .gitignore them and make the default write_tree = FALSE (currently NA, which accounted for the fact that {data.tree} is only available for R >= 3.2, which is irrelevant nowadays).

lorenzwalthert commented 2 months ago

Once this is done, we can rebase #1195 on main to avoid its large tree diff.