Skip to content

Commit 1eb19d5

Browse files
authored
CVE-2022-24765 exception (#56)
1 parent 824c7d8 commit 1eb19d5

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

.lintr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
linters: with_defaults(
2+
line_length_linter = line_length_linter(120),
3+
cyclocomp_linter = NULL,
4+
object_usage_linter = NULL
5+
)

report-generator.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# Location
44
cat(sprintf("Current dir is: '%s'", getwd()))
55

6+
# CVE-2022-24765 exception
7+
git_safe_dir <- system(
8+
sprintf("git config --global --add safe.directory '%s'", getwd())
9+
)
10+
611
# Get the action inputs from preset env vars
712
pkg_dir <- normalizePath(Sys.getenv("INPUT_REPORT_PKG_DIR", "."))
813
template_path <- Sys.getenv("INPUT_REPORT_TEMPLATE_PATH", "/template.Rmd")

template.Rmd

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ knitr::opts_chunk$set(
3838
comment = ""
3939
)
4040
41-
helper_tabulate <- function(x, caption = "", col_widths = c("10cm","5cm")){
41+
helper_tabulate <- function(x, caption = "", col_widths = c("10cm", "5cm")) {
4242
x %>%
4343
kbl(
4444
caption = caption,
4545
booktabs = TRUE, longtable = TRUE
4646
) %>%
4747
kable_styling(
48-
latex_options = c("striped","repeat_header")
48+
latex_options = c("striped", "repeat_header")
4949
) %>%
5050
column_spec(
5151
1, width = col_widths[1]
@@ -80,7 +80,7 @@ data.frame(
8080
R.version$platform,
8181
R.version$system,
8282
format(Sys.time(), tz = "UTC", usetz = TRUE)
83-
)) %>% helper_tabulate("System info",col_widths = c("6cm","6cm"))
83+
)) %>% helper_tabulate("System info", col_widths = c("6cm", "6cm"))
8484
```
8585

8686
## Package installed
@@ -97,10 +97,18 @@ wt <- sprintf("--work-tree='%s'", params$pkg_dir)
9797
data.frame(
9898
Field = c("branch", "commit `SHA1`", "commit date"),
9999
Value = c(
100-
system2("git", list(gd, wt, "rev-parse", "--abbrev-ref", "HEAD"), stdout = TRUE),
100+
system2(
101+
"git",
102+
list(gd, wt, "rev-parse", "--abbrev-ref", "HEAD"),
103+
stdout = TRUE
104+
),
101105
system2("git", list(gd, wt, "rev-parse", "HEAD"), stdout = TRUE),
102-
system2("git", list(gd, wt, "show", "-s", "--format=%ci", "HEAD"), stdout = TRUE)
103-
)) %>% helper_tabulate("Git information",col_widths = c("5cm","8cm"))
106+
system2(
107+
"git",
108+
list(gd, wt, "show", "-s", "--format=%ci", "HEAD"),
109+
stdout = TRUE
110+
)
111+
)) %>% helper_tabulate("Git information", col_widths = c("5cm", "8cm"))
104112
```
105113

106114
## R Session Info
@@ -118,22 +126,22 @@ The following metrics are derived from the `riskmetric` R package. Metrics overl
118126
d_riskmetric <- params$pkg_dir %>%
119127
riskmetric::pkg_ref() %>%
120128
riskmetric::pkg_assess() %>%
121-
purrr::map(1) %>%
129+
purrr::map(1) %>%
122130
lapply(as.character) %>%
123-
tibble::enframe() %>%
131+
tibble::enframe() %>%
124132
tidyr::unnest(cols = dplyr::everything()) %>%
125133
# add labels
126134
dplyr::left_join(
127135
lapply(riskmetric::all_assessments(), attributes) %>%
128136
purrr::map_df(tibble::as_tibble),
129137
by = c("name" = "column_name")
130-
)
138+
)
131139
132140
d_riskmetric %>%
133141
dplyr::filter(
134142
name %in% c(
135-
"news_current","has_vignettes",
136-
"license","downloads_1yr"
143+
"news_current", "has_vignettes",
144+
"license", "downloads_1yr"
137145
)
138146
) %>%
139147
dplyr::select(Metric = label, Status = value) %>%
@@ -186,20 +194,22 @@ if (require("covtracer", quietly = TRUE)) {
186194
alias,
187195
test_name,
188196
file,
189-
is_exported,doctype,direct
197+
is_exported,
198+
doctype,
199+
direct
190200
) %>%
191201
dplyr::filter(!doctype %in% c("data", "class")) %>% # ignore objects without testable code
192202
dplyr::filter(is_exported == TRUE) %>% # Only exported
193203
dplyr::filter(!duplicated(.)) %>%
194-
dplyr::mutate(alias = paste0(alias,"()")) %>%
195-
dplyr::mutate(file = paste0("man/",file))
204+
dplyr::mutate(alias = paste0(alias, "()")) %>%
205+
dplyr::mutate(file = paste0("man/", file))
196206
197207
covtracer_df_clean %>%
198208
dplyr::filter(!duplicated(.)) %>%
199209
dplyr::filter(!is.na(test_name)) %>%
200210
dplyr::filter(!is.na(file)) %>% # unexported?
201211
dplyr::arrange(file) %>%
202-
dplyr::select(`Test Description` = test_name, Documentation = file) %>%
212+
dplyr::select(`Test Description` = test_name, Documentation = file) %>%
203213
helper_tabulate(
204214
caption = "Tracebility matrix mapping unit tests to documented behaviours."
205215
)

0 commit comments

Comments
 (0)