Skip to content

Commit b333d52

Browse files
authored
Merge branch 'master' into issue5829
2 parents dbb7794 + d45546b commit b333d52

File tree

119 files changed

+18683
-5347
lines changed

Some content is hidden

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

119 files changed

+18683
-5347
lines changed

.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(c("vignettes", "vignettes/fr"), 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/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.")

.dev/CRAN_Release.cmd

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
###############################################
44

55
# 1) Update messages for new release
6-
## (a) Update C template file: src/data.table.pot
7-
## ideally, we are including _() wrapping in
8-
## new PRs throughout dev cycle, and this step
9-
## becomes about tying up loose ends
10-
## Check the output here for translatable messages
11-
xgettext -o /dev/stdout ./*.c \
12-
--keyword=Rprintf --keyword=error --keyword=warning --keyword=STOP --keyword=DTWARN --keyword=Error --keyword=DTPRINT --keyword=snprintf:3
13-
14-
## (b) Update R template file: src/R-data.table.pot
15-
## NB: this relies on R >= 4.0 to remove a bug in update_pkg_po
16-
Rscript -e "tools::update_pkg_po('.')"
6+
dt_custom_translators = list(
7+
R = 'catf:fmt|1',
8+
# TODO(MichaelChirico/potools#318): restore snprintf:3 here too
9+
src = c('STOP:1', 'DTWARN:1', 'DTPRINT:1')
10+
)
11+
message_db =
12+
potools::get_message_data(custom_translation_functions = dt_custom_translators)
13+
potools::check_cracked_messages(message_db)
14+
potools::check_untranslated_cat(message_db)
15+
potools::check_untranslated_src(message_db)
16+
17+
## (b) Update R template files (po/*.pot)
18+
potools::po_extract(custom_translation_functions = dt_custom_translators)
1719

1820
# 2) Open a PR with the new templates & contact the translators
19-
# * zh_CN: @hongyuanjia
20-
# * pt_BR: @rffontenelle
21-
# * es: @rikivillalba
21+
# using @Rdatatable/<lang>, e.g. @Rdatatable/chinese
2222
## Translators to submit commits with translations to this PR
2323
## [or perhaps, if we get several languages, each to open
2424
## its own PR and merge to main translation PR]
@@ -114,12 +114,6 @@ grep -P "\t" ./src/*.c
114114
grep -n "[^A-Za-z0-9]T[^A-Za-z0-9]" ./inst/tests/tests.Rraw
115115
grep -n "[^A-Za-z0-9]F[^A-Za-z0-9]" ./inst/tests/tests.Rraw
116116

117-
# All integers internally should have L suffix to avoid lots of one-item coercions
118-
# Where 0 numeric is intended we should perhaps use 0.0 for clarity and make the grep easier
119-
# 1) tolerance=0 usages in setops.R are valid numeric 0, as are anything in strings
120-
# 2) leave the rollends default using roll>=0 though; comments in PR #3803
121-
grep -Enr "^[^#]*(?:\[|==|>|<|>=|<=|,|\(|\+)\s*[-]?[0-9]+[^0-9L:.e]" R | grep -Ev "stop|warning|tolerance"
122-
123117
# Never use ifelse. fifelse for vectors when necessary (nothing yet)
124118
grep -Enr "\bifelse" R
125119

@@ -135,10 +129,6 @@ grep -Fn "tryCatch" ./inst/tests/*.Rraw
135129
# All % in *.Rd should be escaped otherwise text gets silently chopped
136130
grep -n "[^\]%" ./man/*.Rd
137131

138-
# if (a & b) is either invalid or inefficient (ditto for replace & with |);
139-
# if(any(a [&|] b)) is appropriate b/c of collapsing the logical vector to scalar
140-
grep -nr "^[^#]*if[^&#]*[^&#\"][&][^&]" R | grep -Ev "if\s*[(](?:any|all)"
141-
142132
# seal leak potential where two unprotected API calls are passed to the same
143133
# function call, usually involving install() or mkChar()
144134
# Greppable thanks to single lines and wide screens

.github/CODE_OF_CONDUCT.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
2+
3+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
4+
5+
Examples of unacceptable behavior by participants include:
6+
7+
* The use of sexualized language or imagery
8+
* Personal attacks
9+
* Trolling or insulting/derogatory comments
10+
* Public or private harassment
11+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
12+
* Other unethical or unprofessional conduct
13+
14+
Project members with the Committer role have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
15+
16+
By adopting this Code of Conduct, project members commit themselves to fairly and consistently apply these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17+
18+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
19+
20+
21+
## Reporting
22+
23+
Project members with the Committer role or the CRAN Maintainer role are pledged to promptly address any reported issues. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to any individual with this role.
24+
25+
Those who prefer to report in a way that is independent of the current Committers and Maintainer may instead contact the Community Engagement Coordinator by e-mailing [r.data.table\@gmail.com](mailto:[email protected]). Messages sent to this e-mail address will be visible only to the current Community Engagement Coordinator, a position always held by an individual who is not a Committer or CRAN Maintainer of the package.
26+
27+
The current Committers are Toby Dylan Hocking (@tdhock), Matt Dowle (@mattdowle), Arun Srinivasan (@arunsrinivasan), Jan Gorecki (@jangorecki), Michael Chirico (@MichaelChirico), and Benjamin Schwendinger (@ben-schwen).
28+
29+
The current CRAN Maintainer is Tyson Barrett (@tysonstanley).
30+
31+
The current Community Engagement Coordinator is Kelly Bodwin (@kbodwin).
32+
33+
All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Complaint respondents are obligated to maintain confidentiality with regard to the reporter of an incident.
34+
35+
This Code of Conduct is adapted from the [Contributor Covenant, version 1.3.0](https://www.contributor-covenant.org/version/1/3/0/code-of-conduct/), available at [https://www.contributor-covenant.org/version/1/3/0/](https://www.contributor-covenant.org/version/1/3/0/), and the Swift Code of Conduct.

.github/workflows/code-quality.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v4
3737
- uses: r-lib/actions/setup-r@v2
38+
- name: Install Coccinelle
39+
# relying on the action above us to have updated the package cache
40+
run: /usr/bin/sudo apt-get -y install coccinelle
3841
- name: Lint
3942
run: |
4043
linter_env = new.env()

.github/workflows/pkgup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
cp -R ${{ env.R_LIBS_USER }} library
5151
R CMD INSTALL --library="library" $(ls -1t data.table_*.tar.gz | head -n 1) --html
5252
mkdir -p doc/html
53-
cp /usr/share/R/doc/html/{left.jpg,up.jpg,Rlogo.svg,R.css,index.html} doc/html
53+
cp $(R RHOME)/doc/html/{left.jpg,up.jpg,Rlogo.svg,R.css,index.html} doc/html
5454
Rscript -e 'utils::make.packages.html("library", docdir="doc")'
5555
sed -i "s|file://|../..|g" doc/html/packages.html
5656
mkdir -p public

.gitlab-ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ mirror-packages:
4444
stage: dependencies
4545
tags:
4646
- saas-linux-medium-amd64
47-
image: registry.gitlab.com/jangorecki/dockerfiles/r-base-minimal
47+
image: registry.gitlab.com/rdatatable/dockerfiles/r-base-minimal
4848
cache:
4949
paths:
5050
- bus/$CI_JOB_NAME/cran
@@ -67,7 +67,7 @@ build:
6767
stage: build
6868
tags:
6969
- saas-linux-medium-amd64
70-
image: registry.gitlab.com/jangorecki/dockerfiles/r-base-gcc
70+
image: registry.gitlab.com/rdatatable/dockerfiles/r-base-gcc
7171
needs: ["mirror-packages"]
7272
before_script:
7373
- *install-deps
@@ -106,7 +106,7 @@ build:
106106
# tests for compilation warnings
107107
test-lin-rel:
108108
<<: *test-lin
109-
image: registry.gitlab.com/jangorecki/dockerfiles/r-data.table
109+
image: registry.gitlab.com/rdatatable/dockerfiles/r-data.table
110110
variables:
111111
_R_CHECK_COMPILATION_FLAGS_KNOWN_: "-Wvla"
112112
_R_CHECK_CRAN_INCOMING_: "FALSE"
@@ -128,7 +128,7 @@ test-lin-rel:
128128
# flags: gcc -O0 -fno-openmp
129129
test-lin-rel-vanilla:
130130
<<: *test-lin
131-
image: registry.gitlab.com/jangorecki/dockerfiles/r-base-gcc
131+
image: registry.gitlab.com/rdatatable/dockerfiles/r-base-gcc
132132
variables:
133133
_R_CHECK_COMPILATION_FLAGS_KNOWN_: "-Wvla"
134134
script:
@@ -141,7 +141,7 @@ test-lin-rel-vanilla:
141141
# extra NOTEs check and build pdf manual thus not from cran-lin template
142142
test-lin-rel-cran:
143143
<<: *test-lin
144-
image: registry.gitlab.com/jangorecki/dockerfiles/r-base
144+
image: registry.gitlab.com/rdatatable/dockerfiles/r-base
145145
variables:
146146
_R_CHECK_CRAN_INCOMING_: "TRUE" ## stricter --as-cran checks should run in dev pipelines continuously (not sure what they are though)
147147
_R_CHECK_CRAN_INCOMING_REMOTE_: "FALSE" ## Other than no URL checking (takes many minutes) or 'Days since last update 0' NOTEs needed, #3284
@@ -161,7 +161,7 @@ test-lin-rel-cran:
161161
# tests for new notes
162162
test-lin-dev-gcc-strict-cran:
163163
<<: *test-lin
164-
image: registry.gitlab.com/jangorecki/dockerfiles/r-devel-gcc-strict
164+
image: registry.gitlab.com/rdatatable/dockerfiles/r-devel-gcc-strict
165165
variables:
166166
_R_CHECK_COMPILATION_FLAGS_KNOWN_: "-Wvla"
167167
_R_CHECK_CRAN_INCOMING_: "TRUE"
@@ -183,7 +183,7 @@ test-lin-dev-gcc-strict-cran:
183183
# tests for new notes
184184
test-lin-dev-clang-cran:
185185
<<: *test-lin
186-
image: registry.gitlab.com/jangorecki/dockerfiles/r-devel-clang
186+
image: registry.gitlab.com/rdatatable/dockerfiles/r-devel-clang
187187
variables:
188188
_R_CHECK_COMPILATION_FLAGS_KNOWN_: "-Wvla"
189189
_R_CHECK_CRAN_INCOMING_: "TRUE"
@@ -203,7 +203,7 @@ test-lin-dev-clang-cran:
203203
# stated dependency on R
204204
test-lin-ancient-cran:
205205
<<: *test-lin
206-
image: registry.gitlab.com/jangorecki/dockerfiles/r-3.3.0
206+
image: registry.gitlab.com/rdatatable/dockerfiles/r-3.3.0
207207
variables:
208208
_R_CHECK_FORCE_SUGGESTS_: "FALSE" # can be removed if all dependencies are available (knitr, xts, etc.)
209209
script:
@@ -306,7 +306,7 @@ test-mac-old:
306306
# generating pkgdown website
307307
integration:
308308
stage: integration
309-
image: registry.gitlab.com/jangorecki/dockerfiles/r-pkgdown
309+
image: registry.gitlab.com/rdatatable/dockerfiles/r-pkgdown
310310
tags:
311311
- saas-linux-medium-amd64
312312
only:

0 commit comments

Comments
 (0)