diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml new file mode 100644 index 0000000..c188ae2 --- /dev/null +++ b/.github/workflows/linter.yaml @@ -0,0 +1,55 @@ +--- +########################### +########################### +## Linter GitHub Actions ## +########################### +########################### +name: Lint Code Base + +# +# Documentation: +# https://help.github.com/en/articles/workflow-syntax-for-github-actions +# + +############################# +# Start the job on all push # +############################# +on: + push: + branches-ignore: [master] + # Remove the line above to run when pushing to master + pull_request: + branches: [master] + +############### +# Set the Job # +############### +jobs: + build: + # Name the Job + name: Lint Code Base + # Set the agent to run on + runs-on: ubuntu-latest + + ################## + # Load all steps # + ################## + steps: + ########################## + # Checkout the code base # + ########################## + - name: Checkout Code + uses: actions/checkout@v2 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + ################################ + # Run Linter against code base # + ################################ + - name: Lint Code Base + uses: github/super-linter@v3 + env: + VALIDATE_ALL_CODEBASE: false + DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/NAMESPACE b/NAMESPACE index eed41f5..67d2a33 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,4 +16,5 @@ export(remove_dep) export(use_codecov2) export(use_onbuild_image) export(use_radian) +export(use_superlinter) export(view_url) diff --git a/R/testing.R b/R/testing.R index d1d456b..a10166e 100644 --- a/R/testing.R +++ b/R/testing.R @@ -1,12 +1,26 @@ #' Set up codecov -#' @param reposlug `[character(1)]` giving the `username/repo` URL slug of the project. -#' @family testing functions +#' @param reposlug `[character(1)]` +#' giving the `username/repo` URL slug of the project. +#' @family quality control functions #' @export use_codecov2 <- function(reposlug) { usethis::use_coverage(type = "codecov") - usethis::ui_todo( - "Add the {usethis::ui_value('Repository Upload Token')} from codecov as a secret called {usethis::ui_value('CODECOV_TOKEN')} on GitHub." - ) + usethis::ui_todo(c( + "Add the {usethis::ui_value('Repository Upload Token')} from codecov ", + "as a secret called {usethis::ui_value('CODECOV_TOKEN')} on GitHub." + )) view_url("https://codecov.io/gh", reposlug, "settings") view_url("https://github.com", reposlug, "settings", "secrets") } + +#' Set up [super-linter](https://github.com/github/super-linter) +#' @family quality control functions +#' @export +use_superlinter <- function() { + superlinter_url <- "https://github.com/marketplace/actions/super-linter" + usethis::ui_todo(c( + "Please add the {usethis::ui_code{'linter.yaml'} ", + "as described on {usethis::ui_code{superlinter_url}." + )) + view_url(superlinter_url) +} diff --git a/man/use_codecov2.Rd b/man/use_codecov2.Rd index 722de52..2afb780 100644 --- a/man/use_codecov2.Rd +++ b/man/use_codecov2.Rd @@ -7,9 +7,14 @@ use_codecov2(reposlug) } \arguments{ -\item{reposlug}{\verb{[character(1)]} giving the \code{username/repo} URL slug of the project.} +\item{reposlug}{\verb{[character(1)]} +giving the \code{username/repo} URL slug of the project.} } \description{ Set up codecov } -\concept{testing functions} +\seealso{ +Other quality control functions: +\code{\link{use_superlinter}()} +} +\concept{quality control functions} diff --git a/man/use_superlinter.Rd b/man/use_superlinter.Rd new file mode 100644 index 0000000..c9827f7 --- /dev/null +++ b/man/use_superlinter.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/testing.R +\name{use_superlinter} +\alias{use_superlinter} +\title{Set up \href{https://github.com/github/super-linter}{super-linter}} +\usage{ +use_superlinter() +} +\description{ +Set up \href{https://github.com/github/super-linter}{super-linter} +} +\seealso{ +Other quality control functions: +\code{\link{use_codecov2}()} +} +\concept{quality control functions} diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 876ce7a..b81ac30 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -28,11 +28,11 @@ reference: Setting up RStudio and vscode. - contents: - has_concept("editor functions") -- subtitle: Testing +- subtitle: Quality Control desc: > - Set up unit testing. + Set up testing and linting. - contents: - - has_concept("testing functions") + - has_concept("quality control functions") - subtitle: Deployment desc: > Deploy muggle projects to the public cloud.