imperialCHEPI / healthgpsrvis

A set of scripts for plotting and visualising data related to Health-GPS
https://imperialchepi.github.io/healthgpsrvis/
Other
0 stars 0 forks source link

Set up pre-commit yaml #6

Open SaranjeetKaur opened 3 months ago

SaranjeetKaur commented 3 months ago
alexdewar commented 3 months ago

I just came on here to post this because I noticed the pre-commit CI app was failing. Bigger picture, it's my fault for enabling it for every repo on the org unconditionally, but if you're going to use pre-commit anyway then that'll also fix things :smile:

Do you think I should disable it for new repos @jamesturner246? I mean, we don't have many repos on here and most of them do use pre-commit, but...

SaranjeetKaur commented 3 months ago

Hi @alexdewar, I am planning to include pre-commit on this repo. I would have done that by now but I am running into some errors and will be catching up with James shortly today to work on it

SaranjeetKaur commented 3 months ago

Steps to autogenerate .pre-commit-config.yaml in RStudio on Windows:

  1. precommit_path <- "C:/Users/ssbhogal/.pyenv/pyenv-win/versions/3.11.0/Scripts/pre-commit.exe" # path to the pre-commit executable
  2. options(precommit.executable = precommit_path) # set R options
  3. getOption("precommit.executable") should return the path to the executable, if everything is ok. In this case, it will return "C:/Users/ssbhogal/.pyenv/pyenv-win/versions/3.11.0/Scripts/pre-commit.exe". The same output will also be returned if instead you use precommit::path_precommit_exec().
  4. use precommit::use_precommit() to autogenerate .pre-commit-config.yaml
  5. If you are using the roxygenize hook, then this requires further edits in your .pre-commit-config.yaml, please run precommit::snippet_generate('additional-deps-roxygenize') to proceed with the same. It will generate the following snippet:

    
    Generating snippet using CRAN versions. If you need another source, specify with syntax that `renv::install()` understands (see examples in help file). 
    
    -   id: roxygenize
        # roxygen requires loading pkg -> add dependencies from DESCRIPTION
        additional_dependencies:
        -    ggplot2
        -    grDevices

• Replace the id: roxygenize key in .pre-commit-config.yaml with the above code. ℹ Note that CI services like have build-time restrictions and installing the above dependencies may exceed those, resulting in a timeout. In addition, system dependencies are not supported for . See vignette("ci", package = "precommit") for details and solutions.

jamesturner246 commented 3 months ago

Ideally we will use it in all repos, eventually, but I'm not against changing it if it prevents issues.