rossyndicate / ROSSyndicate_best_practices

ROSSyndicate best practices repository. A one-stop shop for the lab's coding best practices.
https://rossyndicate.github.io/ROSSyndicate_best_practices/
MIT License
1 stars 3 forks source link

linters #34

Open nmvross opened 7 months ago

nmvross commented 7 months ago

I'm seeking guidance on how to use linters in my own office as we transition more work to R, and would like advice about best practices/recommended packages for linting R code :) @steeleb

steeleb commented 7 months ago

I'm not sure any of us are consistently using a linter yet!! Here are two options:

You can get the super high-level {styler} which integrates into RStudio: https://www.tidyverse.org/blog/2017/12/styler-1.0.0/ and has a few 'preset' settings for style (including tidyverse).

There is also {lintr}: https://www.tidyverse.org/blog/2022/07/lintr-3-0-0/, which is arguably more robust, but is also specific to tidyverse (I think).

I'll be 100% honest that I haven't used {styler} that much, even though it's installed in my IDE (likely to the dismay of my primary code reviewer @mbrousil who graciously tags my inconsistent use of spaces and assignments, which would be caught by this linter), in part because I haven't ingrained it into my personal habits yet. This is maybe a good reminder to do so!

MB, do you have any suggestions here?

mbrousil commented 7 months ago

Historically I've used {lintr} and haven't tried {styler}! I've enjoyed it. Mostly I use it when things are heading towards a final version.