Skip to content

Commit c653cf6

Browse files
committed
Merge branch 'master' into litedown
2 parents 4e7809f + fc43386 commit c653cf6

File tree

150 files changed

+24255
-5889
lines changed

Some content is hidden

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

150 files changed

+24255
-5889
lines changed

.Rbuildignore

Lines changed: 1 addition & 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$

.ci/.lintr.R

Lines changed: 37 additions & 40 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.
@@ -70,43 +71,39 @@ linters = c(dt_linters, all_linters(
7071
))
7172
rm(dt_linters)
7273

73-
# TODO(lintr#2172): Glob with lintr itself.
74-
exclusions = c(local({
75-
exclusion_for_dir <- function(dir, exclusions) {
76-
files = file.path("..", list.files(dir, pattern = "\\.(R|Rmd|Rraw)$", full.names=TRUE))
77-
stats::setNames(rep(list(exclusions), length(files)), files)
78-
}
79-
c(
80-
exclusion_for_dir("tests", list(
81-
quotes_linter = Inf,
82-
# TODO(michaelchirico): Enforce these and re-activate them one-by-one.
83-
implicit_integer_linter = Inf,
84-
infix_spaces_linter = Inf,
85-
undesirable_function_linter = Inf
86-
)),
87-
exclusion_for_dir("vignettes", list(
88-
quotes_linter = Inf,
89-
sample_int_linter = Inf
90-
# strings_as_factors_linter = Inf
91-
# system_time_linter = Inf
92-
)),
93-
exclusion_for_dir("inst/tests", list(
94-
library_call_linter = Inf,
95-
numeric_leading_zero_linter = Inf,
96-
undesirable_operator_linter = Inf, # For ':::', possibly we could be more careful to only exclude ':::'.
97-
# TODO(michaelchirico): Enforce these and re-activate them one-by-one.
98-
comparison_negation_linter = Inf,
99-
condition_call_linter = Inf,
100-
duplicate_argument_linter = Inf,
101-
equals_na_linter = Inf,
102-
missing_argument_linter = Inf,
103-
paste_linter = Inf,
104-
rep_len_linter = Inf,
105-
sample_int_linter = Inf,
106-
seq_linter = Inf,
107-
unnecessary_lambda_linter = Inf
108-
))
74+
exclusions = list(
75+
`../tests` = list(
76+
quotes_linter = Inf,
77+
# TODO(michaelchirico): Enforce these and re-activate them one-by-one.
78+
implicit_integer_linter = Inf,
79+
infix_spaces_linter = Inf,
80+
undesirable_function_linter = Inf
81+
),
82+
`../vignettes*` = list(
83+
# assignment_linter = Inf,
84+
implicit_integer_linter = Inf,
85+
quotes_linter = Inf,
86+
sample_int_linter = Inf
87+
# strings_as_factors_linter = Inf
88+
# system_time_linter = Inf
89+
),
90+
`../inst/tests` = list(
91+
library_call_linter = Inf,
92+
numeric_leading_zero_linter = Inf,
93+
undesirable_operator_linter = Inf, # For ':::', possibly we could be more careful to only exclude ':::'.
94+
# TODO(michaelchirico): Enforce these and re-activate them one-by-one.
95+
comparison_negation_linter = Inf,
96+
condition_call_linter = Inf,
97+
duplicate_argument_linter = Inf,
98+
equals_na_linter = Inf,
99+
missing_argument_linter = Inf,
100+
paste_linter = Inf,
101+
rep_len_linter = Inf,
102+
sample_int_linter = Inf,
103+
seq_linter = Inf,
104+
unnecessary_lambda_linter = Inf
105+
),
106+
`../inst/tests/froll.Rraw` = list(
107+
dt_test_literal_linter = Inf # TODO(michaelchirico): Fix these once #5898, #5692, #5682, #5576, #5575, #5441 are merged.
109108
)
110-
}),
111-
list(`../inst/tests/froll.Rraw` = list(dt_test_literal_linter = Inf)) # TODO(michaelchirico): Fix these once #5898, #5692, #5682, #5576, #5575, #5441 are merged.
112109
)

.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: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,20 @@ test.list <- atime::atime_test_list(
231231
},
232232
expr = data.table:::melt(DT, measure.vars = measure.vars),
233233
Slow = "fd24a3105953f7785ea7414678ed8e04524e6955", # Parent of the merge commit (https://github.com/Rdatatable/data.table/commit/ed72e398df76a0fcfd134a4ad92356690e4210ea) of the PR (https://github.com/Rdatatable/data.table/pull/5054) that fixes the issue
234-
Fast = "ed72e398df76a0fcfd134a4ad92356690e4210ea"), # Merge commit of the PR (https://github.com/Rdatatable/data.table/pull/5054) that fixes the issue
234+
Fast = "ed72e398df76a0fcfd134a4ad92356690e4210ea"), # Merge commit of the PR (https://github.com/Rdatatable/data.table/pull/5054) that fixes the issue # Test case created directly using the atime code below (not adapted from any other benchmark), based on the issue/fix PR https://github.com/Rdatatable/data.table/pull/5054#issue-930603663 "melt should be more efficient when there are missing input columns."
235+
236+
# Test case created from @tdhock's comment https://github.com/Rdatatable/data.table/pull/6393#issuecomment-2327396833, in turn adapted from @philippechataignon's comment https://github.com/Rdatatable/data.table/pull/6393#issuecomment-2326714012
237+
"fwrite refactored in #6393" = atime::atime_test(
238+
setup = {
239+
set.seed(1)
240+
NC = 10L
241+
L <- data.table(i=1:N)
242+
L[, paste0("V", 1:NC) := replicate(NC, rnorm(N), simplify=FALSE)]
243+
out.csv <- tempfile()
244+
},
245+
expr = data.table::fwrite(L, out.csv, compress="gzip"),
246+
Before = "f339aa64c426a9cd7cf2fcb13d91fc4ed353cd31", # Parent of the first commit https://github.com/Rdatatable/data.table/commit/fcc10d73a20837d0f1ad3278ee9168473afa5ff1 in the PR https://github.com/Rdatatable/data.table/pull/6393/commits with major change to fwrite with gzip.
247+
PR = "3630413ae493a5a61b06c50e80d166924d2ef89a"), # Close-to-last merge commit in the PR.
235248

236249
tests=extra.test.list)
237250
# nolint end: undesirable_operator_linter.

.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/publish.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ format.bins <- function(ver, bin_ver, cran.home, os.type, pkg, version, repodir)
2727
plat.path = "windows"
2828
} else if (os.type=="macosx") {
2929
ext = "tgz"
30-
plat.path = "macosx/el-capitan"
30+
plat.path = "macosx/big-sur-arm64"
3131
} else stop("format.bins only valid for 'windows' or 'macosx' os.type")
3232
file = sprintf("bin/%s/contrib/%s/%s_%s.%s", plat.path, bin_ver, pkg, version, ext)
3333
fe = file.exists(file.path(repodir, file))

0 commit comments

Comments
 (0)