Skip to content

Commit 31e324b

Browse files
Merge branch 'master' into R_4_5_isCharASCII
2 parents 6a29ea9 + 93a5305 commit 31e324b

File tree

190 files changed

+39405
-10706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+39405
-10706
lines changed

.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.dir-locals.el
2+
.check.translations.R
23
^\.Rprofile$
34
^data\.table_.*\.tar\.gz$
45
^config\.log$
@@ -16,6 +17,7 @@
1617
^\.devcontainer$
1718
^\.graphics$
1819
^\.github$
20+
^\.vscode$
1921
^\.zed$
2022

2123
^\.gitlab-ci\.yml$
@@ -27,6 +29,7 @@
2729
^src/Makevars$
2830
^CODEOWNERS$
2931
^GOVERNANCE\.md$
32+
^Seal_of_Approval\.md$
3033

3134
^\.RData$
3235
^\.Rhistory$

.ci/.lintr.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ linters = c(dt_linters, all_linters(
99
packages = "lintr", # TODO(lintr->3.2.0): Remove this.
1010
# eq_assignment_linter(),
1111
brace_linter(allow_single_line = TRUE),
12+
implicit_integer_linter(allow_colon = TRUE),
1213
# TODO(michaelchirico): Activate these incrementally. These are the
1314
# parameterizations that match our style guide.
1415
# implicit_assignment_linter(allow_lazy = TRUE, allow_scoped = TRUE),
15-
# implicit_integer_linter(allow_colon = TRUE),
1616
# system_time_linter = undesirable_function_linter(c(
1717
# system.time = "Only run timings in benchmark.Rraw"
1818
# )),
@@ -26,7 +26,8 @@ linters = c(dt_linters, all_linters(
2626
# setwd = NULL
2727
# )),
2828
undesirable_operator_linter(),
29-
# TODO(lintr#2441): Use upstream implementation.
29+
# TODO(lintr#2765): Use upstream implementation.
30+
# assignment_linter(operator = "="),
3031
assignment_linter = NULL,
3132
absolute_path_linter = NULL, # too many false positives
3233
# TODO(lintr#2442): Use this once x[ , j, by] is supported.
@@ -84,7 +85,9 @@ exclusions = c(local({
8485
infix_spaces_linter = Inf,
8586
undesirable_function_linter = Inf
8687
)),
87-
exclusion_for_dir("vignettes", list(
88+
exclusion_for_dir(c("vignettes", "vignettes/fr", "vignettes/ru"), list(
89+
# assignment_linter = Inf,
90+
implicit_integer_linter = Inf,
8891
quotes_linter = Inf,
8992
sample_int_linter = Inf
9093
# strings_as_factors_linter = Inf

.ci/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# data.table continuous integration and deployment
22

3-
On each Pull Request opened in GitHub we run GitHub Actions test jobs to provide prompt feedback about the status of PR. Our main CI pipeline runs on GitLab CI nightly. GitLab repository automatically mirrors our GitHub repository and runs pipeline on `master` branch every night. It tests more environments and different configurations. It publish variety of artifacts.
3+
On each Pull Request opened in GitHub we run GitHub Actions test jobs to provide prompt feedback about the status of PR. Our more thorough main CI pipeline runs nightly on GitLab CI. GitLab repository automatically mirrors our GitHub repository and runs pipeline on `master` branch every night. It tests more environments and different configurations. It publishes a variety of artifacts such as our [homepage](https://rdatatable.gitlab.io/data.table/) and [CRAN-like website for dev version](https://rdatatable.gitlab.io/data.table/web/packages/data.table/index.html), including windows binaries for the dev version.
44

55
## Environments
66

@@ -44,3 +44,22 @@ Base R implemented helper script, [originally proposed to base R](https://svn.r-
4444
### [`publish.R`](./publish.R)
4545

4646
Base R implemented helper script to orchestrate generation of most artifacts and to arrange them nicely. It is being used only in [_integration_ stage in GitLab CI pipeline](./../.gitlab-ci.yml).
47+
48+
## GitLab Open Source Program
49+
50+
We are currently part of the [GitLab for Open Source Program](https://about.gitlab.com/solutions/open-source/). This gives us 50,000 compute minutes per month for our GitLab CI. Our license needs to be renewed yearly (around July) and is currently managed by @ben-schwen.
51+
52+
## Updating CI pipeline
53+
54+
Basic CI checks are also run on every push to the GitLab repository. This can **and should** be used for PRs changing the CI pipeline before merging them to master.
55+
56+
```shell
57+
# fetch changes from remote (GitHub) and push them to GitLab
58+
git fetch [email protected]:Rdatatable/data.table.git new_branch:new_branch
59+
git push
60+
# after updating on GitHub, pull changes from remote and push to GitLab
61+
git pull [email protected]:Rdatatable/data.table.git new_branch
62+
git push
63+
```
64+
65+
Make sure to include a link to the pipeline results in your PR.

.ci/atime/tests.R

Lines changed: 122 additions & 32 deletions
Large diffs are not rendered by default.

.ci/ci.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ mirror.packages <-
111111
function(pkgs,
112112
which = c("Depends", "Imports", "LinkingTo"),
113113
repos = getOption("repos"),
114-
type = c("source", "mac.binary", "win.binary"),
114+
type = c("source", "mac.binary.big-sur-arm64", "win.binary"),
115115
repodir,
116116
except.repodir = repodir,
117117
except.priority = "base",
@@ -169,7 +169,8 @@ function(pkgs,
169169
newpkgs <- newpkgs[availpkgs]
170170
}
171171

172-
pkgsext <- switch(type,
172+
typeshort <- if (startsWith(type, "mac.binary.")) "mac.binary" else type
173+
pkgsext <- switch(typeshort,
173174
"source" = "tar.gz",
174175
"mac.binary" = "tgz",
175176
"win.binary" = "zip")
@@ -181,7 +182,7 @@ function(pkgs,
181182
dp <- utils::download.packages(pkgs = newpkgs, destdir = destdir,
182183
available = db, contriburl = repos.url,
183184
type = type, method = method, quiet = quiet)
184-
tools::write_PACKAGES(dir = destdir, type = type, ...)
185+
tools::write_PACKAGES(dir = destdir, type = typeshort, ...)
185186
dp
186187
}
187188

.ci/linters/c/alloc_linter.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
# 2. Check the next line for a check like 'if (!x || !y)'
55
alloc_linter = function(c_obj) {
66
lines = c_obj$lines
7-
# Be a bit more precise to avoid mentions in comments
8-
alloc_lines = grep(R"{=\s*([(]\w+\s*[*][)])?[mc]alloc[(]}", lines)
7+
# Be a bit more precise to avoid mentions in comments, and allow
8+
# malloc(0) to be used for convenience (e.g. #6757)
9+
alloc_lines = grep(R"{=\s*([(]\w+\s*[*][)])?[mc]alloc[(][^0]}", lines)
910
if (!length(alloc_lines)) return()
1011
# int *tmp=(int*)malloc(...); or just int tmp=malloc(...);
1112
alloc_keys = lines[alloc_lines] |>

.ci/linters/c/cocci_linter.R

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cocci_linter = if (!nzchar(Sys.which("spatch"))) function(...) {} else function(c_obj) {
2+
bad <- FALSE
3+
for (spfile in list.files(".ci/linters/cocci", full.names = TRUE)) {
4+
# Coccinelle parser gets confused sometimes, so ignore stderr and the exit code
5+
out = suppressWarnings(system2(
6+
"spatch",
7+
shQuote(c(
8+
"--sp-file", spfile, c_obj$path, "--recursive-includes",
9+
"-I", R.home("include"), "-I", "src"
10+
)),
11+
stdout = TRUE, stderr = FALSE
12+
))
13+
if (length(out) > 0) {
14+
cat(sprintf("In file '%s', Coccinelle patch '%s' recommends the following changes:\n", c_obj$path, spfile))
15+
writeLines(out)
16+
bad <- TRUE
17+
}
18+
}
19+
if (bad) stop("Please apply the changes above or fix the linter")
20+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@@
2+
type T;
3+
T* E;
4+
@@
5+
- (T*)
6+
E

.ci/linters/md/heading_id_linter.R

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
any_mismatch = FALSE
2+
3+
# ensure that ids are limited to alphanumerics and dashes
4+
# (in particular, dots and underscores break the links)
5+
check_header_ids = function(md) {
6+
# A bit surprisingly, some headings don't start with a letter.
7+
# We're interested in those that set an id to link to, i.e., end with {#id}.
8+
heading_captures = regmatches(md, regexec("^#+ \\S.*[{]#([^}]*)[}]$", md))
9+
lines_with_id = which(lengths(heading_captures) > 0)
10+
ids = vapply(heading_captures[lines_with_id], `[`, '', 2)
11+
# ids must start with a letter and consist of alphanumerics or dashes.
12+
good_ids = grepl('^[A-Za-z][A-Za-z0-9-]*$', ids)
13+
for (line in lines_with_id[!good_ids]) cat(sprintf(
14+
"On line %d, bad heading id '%s':\n%s\n",
15+
line, heading_captures[[line]][2], heading_captures[[line]][1]
16+
))
17+
!all(good_ids)
18+
}
19+
20+
any_error = FALSE
21+
for (vignette in list.files('vignettes', pattern = "[.]Rmd$", recursive = TRUE, full.name = TRUE)) {
22+
cat(sprintf("Checking vignette file %s...\n", vignette))
23+
rmd_lines = readLines(vignette)
24+
any_error = check_header_ids(rmd_lines) || any_error
25+
}
26+
if (any_error) stop("Please fix the vignette issues above.")

.ci/linters/po/msgfmt_linter.R

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Use msgfmt to check for untranslated/fuzzy messages, and for whether
2+
# the implied .mo compiled form matches that which is already checked in
3+
msgfmt_linter <- function(po_file) {
4+
mo_tmp <- tempfile()
5+
on.exit(unlink(mo_tmp))
6+
7+
res = system2("msgfmt", c("--statistics", po_file, "-o", mo_tmp), stdout=TRUE, stderr=TRUE)
8+
if (any(grepl("untranslated message|fuzzy translation", res))) {
9+
cat(sprintf("In %s, found incomplete translations:\n%s\n", po_file, paste(res, collapse="\n")))
10+
stop("Please fix.")
11+
}
12+
13+
mo_ref = sprintf(
14+
"inst/%s/LC_MESSAGES/%sdata.table.mo",
15+
gsub("^R-|[.]po$", "", po_file),
16+
if (startsWith(basename(po_file), "R-")) "R-" else ""
17+
)
18+
19+
if (!file.exists(mo_ref)) {
20+
stop(po_file, " has not been compiled as ", mo_ref, ". Please fix.")
21+
}
22+
if (tools::md5sum(mo_ref) == tools::md5sum(mo_tmp)) return(invisible())
23+
# TODO(#6517): Re-activate this part of the check to ensure .mo is up to date.
24+
cat(sprintf("Note: MD5 sum of msgfmt output for %s does not match %s.\n", po_file, mo_ref))
25+
return(invisible())
26+
27+
# NB: file.mtime() will probably be wrong, it will reflect the check-out time of the git repo.
28+
last_edit_time = system2("git",
29+
c("log", "-1", '--format="%ad"', "--date=format:'%Y-%m-%d %H:%M:%S'", "--", mo_ref),
30+
stdout=TRUE
31+
)
32+
cat(sprintf(
33+
".mo compilation %s of .po translation %s appears out of date! It was last updated %s\n",
34+
mo_ref, po_file, last_edit_time
35+
))
36+
37+
unmo_tmp = tempfile()
38+
unmo_ref = tempfile()
39+
on.exit(unlink(c(unmo_tmp, unmo_ref)), add=TRUE)
40+
system2("msgunfmt", c(mo_tmp, "-o", unmo_tmp))
41+
system2("msgunfmt", c(mo_ref, "-o", unmo_ref))
42+
cat("Here are the observed differences after converting back to .po:\n\n")
43+
system2("diff", c(unmo_tmp, unmo_ref))
44+
stop("Please fix.")
45+
}

0 commit comments

Comments
 (0)