/
check_project.R
56 lines (47 loc) · 1.61 KB
/
check_project.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#' Run the required quality checks on a project
#'
#' Set or update the required checks via `setup_project()`.
#' @inheritParams read_checklist
#' @inheritParams check_package
#' @export
#' @importFrom assertthat assert_that
#' @importFrom fs is_file
#' @family project
check_project <- function(x = ".", fail = !interactive(), quiet = FALSE) {
x <- read_checklist(x = x)
if (x$package) {
return(check_package(x = x, fail = fail, quiet = quiet))
}
if ("spelling" %in% x$get_required) {
quiet_cat("Checking spelling\n", quiet = quiet)
x <- check_spelling(x = x, quiet = quiet)
}
if ("lintr" %in% x$get_required) {
quiet_cat("Checking code style\n", quiet = quiet)
x <- check_lintr(x = x, quiet = quiet)
}
if ("folder conventions" %in% x$get_required) {
quiet_cat("Checking folders conventions\n", quiet = quiet)
x <- check_folder(x = x)
}
if ("filename conventions" %in% x$get_required) {
quiet_cat("Checking filename conventions\n", quiet = quiet)
x <- check_filename(x = x)
}
if ("license" %in% x$get_required) {
quiet_cat("Checking the license\n", quiet = quiet)
x <- check_license(x = x)
}
if ("CITATION" %in% x$get_required) {
quiet_cat("Checking the citation information\n", quiet = quiet)
x <- update_citation(x = x, quiet = quiet)
}
print(x, quiet = quiet)
if (!x$fail) {
quiet_cat("\nNo problems found. Good job!\n\n", quiet = quiet)
return(invisible(x))
}
assert_that(!fail, msg = "Checking the project revealed some problems.")
quiet_cat("\nChecking the project revealed some problems.\n\n", quiet = quiet)
return(invisible(x))
}