-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use linting to detect undesired function usage (#2541)
Co-authored-by: Maëlle Salmon <[email protected]>
- Loading branch information
Showing
24 changed files
with
350 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ | |
^fake-index.html$ | ||
^CRAN-SUBMISSION$ | ||
^tools$ | ||
^\.lintr.R$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: lint | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::lintr, local::. | ||
needs: lint | ||
|
||
- name: Lint | ||
run: lintr::lint_package() | ||
shell: Rscript {0} | ||
env: | ||
LINTR_ERROR_ON_LINT: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
linters <- list(lintr::undesirable_function_linter( | ||
fun = c( | ||
# Base messaging | ||
"message" = "use cli::cli_inform()", | ||
"warning" = "use cli::cli_warn()", | ||
"stop" = "use cli::cli_abort()", | ||
# rlang messaging | ||
"inform" = "use cli::cli_inform()", | ||
"warn" = "use cli::cli_warn()", | ||
"abort" = "use cli::cli_abort()", | ||
# older cli | ||
"cli_alert_danger" = "use cli::cli_inform()", | ||
"cli_alert_info" = "use cli::cli_inform()", | ||
"cli_alert_success" = "use cli::cli_inform()", | ||
"cli_alert_warning" = "use cli::cli_inform()", | ||
# fs | ||
"file.path" = "use path()", | ||
"dir" = "use dir_ls()", | ||
"dir.create" = "use dir_create()", | ||
"file.copy" = "use file_copy()", | ||
"file.create" = "use file_create()", | ||
"file.exists" = "use file_exists()", | ||
"file.info" = "use file_info()", | ||
"normalizePath" = "use path_real()", | ||
"unlink" = "use file_delete()", | ||
"basename" = "use path_file()", | ||
"dirname" = "use path_dir()", | ||
# i/o | ||
"readLines" = "use read_lines()", | ||
"writeLines" = "use write_lines()" | ||
), | ||
symbol_is_undesirable = FALSE | ||
)) | ||
|
||
exclusions <- list( | ||
"R/import-standalone-obj-type.R", | ||
"R/import-standalone-types-check.R", | ||
"vignettes", | ||
"tests/testthat/assets" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.