Skip to content

Commit 4a22174

Browse files
authored
Merge pull request #152 from mpadge/main
Add describe_check function
2 parents 564db1f + 88fcc1c commit 4a22174

File tree

6 files changed

+780
-1
lines changed

6 files changed

+780
-1
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
S3method(print,goodPractice)
44
export(all_checks)
55
export(checks)
6+
export(describe_check)
67
export(export_json)
78
export(failed_checks)
89
export(failed_positions)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# goodpractice 1.0.5.9000 (dev version)
22

33
* goodpractice now uses cli, and no longer depends on crayon and clisymbols (@olivroy, #167).
4-
54
* If your editor supports it, goodpractice now prints clickable hyperlinks to console.
5+
- New `describe_check()` function to print descriptions of all implemented checks (@152)
66

77
# goodpractice 1.0.5
88

R/lists.R

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,25 @@ CHECKS <- list()
1010
all_checks <- function() {
1111
names(CHECKS)
1212
}
13+
14+
#' Describe one or more checks
15+
#'
16+
#' @param check_name Names of checks to be described.
17+
#' @return List of character descriptions for each \code{check_name}
18+
#' @export
19+
#' @examples
20+
#' describe_check("rcmdcheck_non_portable_makevars")
21+
#' check_name <- c("no_description_depends",
22+
#' "lintr_assignment_linter",
23+
#' "no_import_package_as_a_whole",
24+
#' "rcmdcheck_missing_docs")
25+
#' describe_check(check_name)
26+
#' # Or to see all checks:
27+
#' \dontrun{
28+
#' describe_check(all_checks())
29+
#' }
30+
31+
describe_check <- function(check_name = NULL) {
32+
check_name <- intersect(check_name, names(CHECKS))
33+
lapply(CHECKS[check_name], function(i) i$description)
34+
}

man/describe_check.Rd

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)