File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -304,15 +304,16 @@ get_unapproved_use <- function(approved_packages, used_packages) {
304
304
# '
305
305
get_lint_results <- function (file ) {
306
306
307
- if (! requireNamespace(" lintr" , quietly = TRUE )) {
308
- message(strwrap(" Linting will not be included in the log. Install the
309
- lintr package to use the log.rx.lint feature." ,
310
- prefix = " " , initial = " " ))
311
- return ()
312
- }
313
-
314
307
# lint file if option is turned on
315
308
if (! is.logical(getOption(' log.rx.lint' ))) {
309
+
310
+ if (! requireNamespace(" lintr" , quietly = TRUE )) {
311
+ message(strwrap(" Linting will not be included in the log. Install the
312
+ lintr package to use the log.rx.lint feature." ,
313
+ prefix = " " , initial = " " ))
314
+ return ()
315
+ }
316
+
316
317
lintr :: lint(file , getOption(' log.rx.lint' ))
317
318
}
318
319
}
Original file line number Diff line number Diff line change @@ -174,6 +174,12 @@ test_that("lint returns expected result when using the default log.rx.lint optio
174
174
expect_identical(get_lint_results(filename ), NULL )
175
175
})
176
176
177
+ test_that(" get_lint_results does not return a message if the option set to FALSE" , {
178
+ options(log.rx.lint = FALSE )
179
+ filename <- test_path(" ref" , " ex6.R" )
180
+ expect_no_message(get_lint_results(filename ))
181
+ })
182
+
177
183
test_that(" lint returns expected result when option is changed" , {
178
184
skip_if_not_installed(" lintr" )
179
185
You can’t perform that action at this time.
0 commit comments