Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up goodpractice #18

Closed
jhollway opened this issue Sep 4, 2020 · 8 comments · Fixed by #34
Closed

Set up goodpractice #18

jhollway opened this issue Sep 4, 2020 · 8 comments · Fixed by #34
Assignees
Labels
Sprint Backlog For issues that are to be resolved soon, but not prioritized over sprints.

Comments

@jhollway
Copy link
Collaborator

jhollway commented Sep 4, 2020

https://github.com/MangoTheCat/goodpractice

@henriquesposito
Copy link
Collaborator

Should we make goodpractice a dependency package for now or suggest the goodpractice app in the description file as do for testthat?

@henriquesposito henriquesposito added the Sprint Backlog For issues that are to be resolved soon, but not prioritized over sprints. label Sep 11, 2020
@jhollway
Copy link
Collaborator Author

@jhollway
Copy link
Collaborator Author

See whether you can set up {goodpractice}, {lintr}, {formatR}, and/or {stylr} checks within the checks workflow @henriquesposito ?

@henriquesposito
Copy link
Collaborator

I did not find much information about seating up the goodpractice package as checks within the workflow, but there are some information on lintr (here https://github.com/r-lib/actions/tree/master/examples#lint-workflow)

Based on the info, the following should work on workflow for lintr:

  • name: Install dependencies
    run: |
    install.packages(c("remotes"))
    remotes::install_deps(dependencies = TRUE)
    remotes::install_cran("lintr")
    shell: Rscript {0}

  • name: Lint
    run: lintr::lint_package()
    shell: Rscript {0}

This implies that something similar could possibly work for goodpractice ...

  • name: Install dependencies
    run: |
    install.packages(c("remotes"))
    remotes::install_deps(dependencies = TRUE)
    remotes::install_cran("goodpractice")
    shell: Rscript {0}

  • name: CP
    goodpractice::cp()
    cp <- goodpractice::cp()
    dir.create("cp")
    file.copy(CP, "cp")
    shell: Rscript {0}

  • name: Save CP
    uses: actions/upload-cp@v1
    with:
    name: ${{ matrix.config.asset_name }}
    path: cp/

I have found some discussions on formatR and stylr in the workflow (here r-lib/styler#636 (comment) and here r-lib/actions#84). I think these would work similar to the above, but I am not sure yet.

I did not want to change workflows on GitHub, would you like me to try and set up these tests in a different workflow document?

I am not sure it will work but I do think setting these up in the workflow are a great solution to avoid too many package dependencies.

jhollway added a commit that referenced this issue Sep 24, 2020
@jhollway
Copy link
Collaborator Author

@henriquesposito I've added {lintr} and {goodpractice} to prchecks.yaml. If you open a PR, we should be able to test this.

But what about styler and formatR?

@henriquesposito
Copy link
Collaborator

I am still trying to see how other developers use styler and/or formatR in their workflows. I understand that both packages are used to reformat R scripts and codes to more exchangeable forms. How do we intend to use them in our workflow? Can we use the workflow to format files or only to check on work?

In formatR there is the tidy_eval function that could work as a check in workflow, but it also appears that it formats code as well.

In any case, from what I found, the tidyverse_style function in styler appears to be well regarded. And that both could be used together, though it could be redundant.

(I am having issues with qDatr because the repository name was changed. I had to delete and re-clone the repository a couple times. Will try and open the PR now.)

@jhollway
Copy link
Collaborator Author

If possible, @henriquesposito can you find out if/how we can export lintr/goodpractice checks to the Pull Request window?

@henriquesposito
Copy link
Collaborator

I have been looking into this but have not found anything about exporting the goodpractice results to the pull request window.

But I have found this very good resource that gives tips on automating the workflows: https://blog.r-hub.io/2020/04/29/maintenance/

I think we can also automate spell checks by adding the spelling package as a dependency and adding the following to the checks file:

name: Spell Check
run: spelling::spell_check_package()
shell: Rscript {0}

The blog above also mentions styler as a resource for code re-styling but I am not sure how to incorporate it to the workflows just yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sprint Backlog For issues that are to be resolved soon, but not prioritized over sprints.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants