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

Github Actions Test Note #438

Open
Felixmil opened this issue Mar 27, 2023 · 0 comments
Open

Github Actions Test Note #438

Felixmil opened this issue Mar 27, 2023 · 0 comments
Assignees

Comments

@Felixmil
Copy link
Contributor

Felixmil commented Mar 27, 2023

As requested in #424 (comment)

These tests were performed on my fork and a specific branch.

Setup Github Action

Setup using {usethis}

usethis::use_github_action_check_release()

Problem: {ospsuite.utils} could not be installed.

I had to add a Remotes field in DESCRIPTION so the github action could install the dependency (it links back to #430).

R CMD Check Action [✅ DONE]

The automated check was able to locate the intentional code error. It also raised few notes about ggplot2 pronouns but can be solved easily..

Removing the intentional error led to a successful build.

Linter [✅ DONE]

Setup using {usethis}

usethis::use_github_action("lint")

The linter github action ran as expected but shows too many warnings (3780):

dir n warning
R 2246
inst 1012
tests 325
vignettes 197

image

To be useful, the linter would need to be configured:

  1. ignore the inst directory,
  2. Configure object_name_linter to accept symbols, CamelCase and camelCase,
  3. ignore line length linter,
  4. ignore the shinyApp code

With the folowing .lintr file (initiated by lintr::use_lintr())

linters: linters_with_defaults(
    object_name_linter(styles = c("CamelCase", "camelCase", "symbols", "dotted.case")), # according to naming rules
    line_length_linter = NULL, # not a big deal
    commented_code_linter = NULL, # maybe we should decide on that ?
    object_length_linter = NULL, # maybe we could fix that
    cyclocomp_linter = NULL # what is the impact of too high cyclocomp ?
  )
exclusions: list(
    "inst", # not really code
    "tests/testthat/test-predefined-functions.R", # weird function names
    "R/aggregation-input.R"  # weird functions tests
  )
encoding: "UTF-8"

With this configuration, we get the following result:

Warning: file=R/atom-plots.R,line=651,col=3,[object_usage_linter] local variable ‘legendLength’ assigned but may not be used
Warning: file=R/plot-histogram.R,line=121,col=20,[object_usage_linter] no visible binding for global variable ‘count’
Warning: file=R/plot-histogram.R,line=131,col=22,[object_usage_linter] no visible binding for global variable ‘ncount’
Warning: file=R/plot-histogram.R,line=131,col=35,[object_usage_linter] no visible binding for global variable ‘width’
Warning: file=R/plot-histogram.R,line=140,col=24,[object_usage_linter] no visible binding for global variable ‘count’
Warning: file=R/plot-histogram.R,line=140,col=24,[object_usage_linter] no visible binding for global variable ‘count’
Warning: file=R/plot-timeprofile.R,line=240,col=3,[object_usage_linter] local variable ‘simColorValues’ assigned but may not be used
Warning: file=R/plot-timeprofile.R,line=269,col=3,[object_usage_linter] local variable ‘obsColorValues’ assigned but may not be used
Warning: file=R/plot-timeprofile.R,line=336,col=56,[vector_logic_linter] Conditional expressions require scalar logical operators (&& and ||)
Warning: file=R/utilities-axis.R,line=[19](https://github.com/Felixmil/TLF-Library/actions/runs/4544729742/jobs/8011142798#step:5:20)6,col=24,[seq_linter] 1:length(...) is likely to be wrong in the empty edge case. Use seq_along(...) instead.
Warning: file=R/utilities-export.R,line=281,col=65,[vector_logic_linter] Conditional expressions require scalar logical operators (&& and ||)
Warning: file=R/utilities-mapping.R,line=234,col=23,[vector_logic_linter] Conditional expressions require scalar logical operators (&& and ||)
Warning: file=tests/testthat/test-plot-grid.R,line=6,col=1,[object_name_linter] Variable and function name style should be CamelCase, camelCase, symbols or dotted.case.
Warning: file=vignettes/tlf.Rmd,line=125,col=[23](https://github.com/Felixmil/TLF-Library/actions/runs/4544729742/jobs/8011142798#step:5:24),[seq_linter] 1:nrow(...) is likely to be wrong in the empty edge case. Use seq_len(nrow(...)) instead.

Each of these warning are fixable. Once fixed, future lintr run would provide good feedback on new code lines.

Code Coverage [✅ DONE]

Setup using

usethis::use_github_action("test-coverage")

Add codecov.io token in Github repo's secret variables.

in test-coverage.yaml replace covr::codecov() call by:

covr::codecov(
  quiet = FALSE,
  clean = FALSE,
  install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package"),
  token =  "${{ secrets.CODECOV_TOKEN }}"
  )

add tidyverse codecov.yml

comment: false

coverage:
  status:
    project:
      default:
        target: auto
        threshold: 1%
        informational: true
    patch:
      default:
        target: auto
        threshold: 1%
        informational: true

Style code [❌ TO DO]

usethis::use_github_action("style")

Badges [❌ TO DO]

@Felixmil Felixmil self-assigned this Mar 27, 2023
@Felixmil Felixmil changed the title Github Action Test Note Github Actions Test Note Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant