Skip to content

Commit 594d126

Browse files
authored
Merge branch 'master' into error-enhance
2 parents 822964f + 17aa167 commit 594d126

Some content is hidden

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

98 files changed

+18344
-5143
lines changed

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

CODEOWNERS

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@
4545
/R/translation.R @michaelchirico
4646
/src/po.h @michaelchirico
4747
/po/*.pot @Rdatatable/translators
48-
/po/*zh_CN.po @Rdatatable/chinese
49-
/po/*pt_BR.po @Rdatatable/brazil
5048
/po/*es.po @Rdatatable/spanish
49+
/po/*fr.po @Rdatatable/french
50+
/po/*pt_BR.po @Rdatatable/brazil
51+
/po/*ru.po @Rdatatable/russian
52+
/po/*zh_CN.po @Rdatatable/chinese
53+
/vignettes/fr/*.Rmd @Rdatatable/french
54+
/vignettes/ru/*.Rmd @Rdatatable/russian
5155

5256
# printing
5357
/R/print.data.table.R @michaelchirico

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: data.table
2-
Version: 1.16.99
2+
Version: 1.17.99
33
Title: Extension of `data.frame`
44
Depends: R (>= 3.3.0)
55
Imports: methods
@@ -19,6 +19,7 @@ Authors@R: c(
1919
person("Michael","Chirico", role="aut", comment = c(ORCID="0000-0003-0787-087X")),
2020
person("Toby","Hocking", role="aut", comment = c(ORCID="0000-0002-3146-0865")),
2121
person("Benjamin","Schwendinger",role="aut", comment = c(ORCID="0000-0003-3315-8114")),
22+
person("Ivan", "Krylov", role="aut", email="[email protected]", comment = c(ORCID="0000-0002-0172-3812")),
2223
person("Pasha","Stetsenko", role="ctb"),
2324
person("Tom","Short", role="ctb"),
2425
person("Steve","Lianoglou", role="ctb"),
@@ -89,7 +90,6 @@ Authors@R: c(
8990
person("Iago", "Giné-Vázquez", role="ctb"),
9091
person("Anirban", "Chetia", role="ctb"),
9192
person("Doris", "Amoakohene", role="ctb"),
92-
person("Ivan", "Krylov", role="ctb"),
9393
person("Angel", "Feliz", role="ctb"),
9494
person("Michael","Young", role="ctb"),
9595
person("Mark", "Seeto", role="ctb"),

0 commit comments

Comments
 (0)