NOAA-FIMS / FIMS-planning

:fish: :chart_with_upwards_trend: :ocean: a place to manage FIMS' planning process
2 stars 0 forks source link

Automated workflow to style code #27

Closed ChristineStawitz-NOAA closed 2 years ago

Bai-Li-NOAA commented 2 years ago

I suggest that we use following reusable workflow to style R code:

ghactions4r::use_style_r_code()

More details about ghactions4r can be found here: https://github.com/nmfs-fish-tools/ghactions4r

kellijohnson-NOAA commented 2 years ago

I think the unresolved question from the discussion about the workflow is when does the code go through a styler, before or after a pull request? I have only worked on projects that do the latter but I know both are options.

Bai-Li-NOAA commented 2 years ago

Thanks Kelli for explaining the unresolved question. I also have not tried option 1 (before a PR) and I haven't had any issues with the latter option.

Notable integration options from styler developers can be found here: https://styler.r-lib.org/articles/third-party-integrations.html

Details about how to use styler as a pre-commit hook can be found here: https://lorenzwalthert.github.io/precommit/. It seems that "when any file is changed due to running a hook or the hook script errors, the commit will fail". May need some Git training if we use this approach.

@ChristineStawitz-NOAA, I removed myself from the assignees and please feel free to add the workflow leader there. I could not add Kristan there for some reason.

ChristineStawitz-NOAA commented 2 years ago

Consider discussion from https://github.com/NOAA-FIMS/collaborative_workflow/issues/22 which I am closing as a duplicate

ChristineStawitz-NOAA commented 2 years ago

added an actoin for both clang-tidy and styler