Skip to content

Commit

Permalink
r-lib#1746 better cleanup, use file_path better
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyk7440 committed Nov 6, 2022
1 parent 50fec27 commit 7fb1087
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/testthat/test-lint_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,22 @@ test_that(

pkg_path <- test_path("dummy_packages", "github_lintr_file")

# In `github/linters`add a `.lintr` file that excludes the whole of `abc.R`
# and the first line of `jkl.R` (and remove it on finishing this test)
dir.create(
path = file.path(pkg_path, ".github/linters/"),
path = file.path(pkg_path, ".github", "linters/"),
recursive = TRUE
)

# In `github/linters`add a `.lintr` file that excludes the whole of `abc.R`
# and the first line of `jkl.R` (and remove it on finishing this test)
local_config(file.path(pkg_path, ".github/linters"), "exclusions: list('R/abc.R', 'R/jkl.R' = 1)")
local_config(file.path(pkg_path, ".github", "linters"), "exclusions: list('R/abc.R', 'R/jkl.R' = 1)")

lints_using_github_lintr <- withr::with_dir(
pkg_path,
lint_package(".", linters = list(assignment_linter()))
)

file.remove(paste0(pkg_path, "/.github/linters/.lintr"))
# Cleanup directory and files created above
unlink(file.path(pkg_path, ".github"), recursive = TRUE)

# Now add the same file to the package root
local_config(pkg_path, "exclusions: list('R/abc.R', 'R/jkl.R' = 1)")
Expand Down

0 comments on commit 7fb1087

Please sign in to comment.