Copilot commented on code in PR #50499: URL: https://github.com/apache/arrow/pull/50499#discussion_r3925830758
########## r/tools/contributor_stats.R: ########## @@ -0,0 +1,111 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Contributor statistics for release announcements. +# +# The `print_new_contributors()` helper below is adapted from Bryce Mecum's gist: +# https://gist.github.com/amoeba/4e26c064d1a0d0227cd8c2260cf0072a +# Review Comment: This PR adds a new release helper script (`r/tools/contributor_stats.R`), but the PR description only lists the Claude skill, RAT excludes, and PACKAGING.md edits. Please update the PR description to mention the new script (it’s also referenced from PACKAGING/skill). ########## r/tools/contributor_stats.R: ########## @@ -0,0 +1,111 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Contributor statistics for release announcements. +# +# The `print_new_contributors()` helper below is adapted from Bryce Mecum's gist: +# https://gist.github.com/amoeba/4e26c064d1a0d0227cd8c2260cf0072a +# +# Usage: launch R from the root of the arrow git repo, then: +# +# source("r/tools/contributor_stats.R") +# release_contributor_stats("apache-arrow-20.0.0", "apache-arrow-21.0.0") +# +# or, for just the list of first-time contributors to a subdirectory: +# +# print_new_contributors("apache-arrow-20.0.0", "apache-arrow-21.0.0", "r") + +# Run a git command, erroring if it fails. Returns stdout as a character vector. +git <- function(...) { + out <- suppressWarnings(system2("git", c(...), stdout = TRUE, stderr = TRUE)) + status <- attr(out, "status") + if (!is.null(status) && status != 0) { + stop("git ", paste(c(...), collapse = " "), " failed:\n", paste(out, collapse = "\n")) + } + as.character(out) +} + +stopifnotinrepo <- function() { + git("rev-parse", "--is-inside-work-tree") + invisible(TRUE) +} Review Comment: `release_contributor_stats()` and `contributors_between()` rely on the current working directory: if the script is sourced from a subdirectory, the default `subdirectory = "."` will cause contributor counts (especially `total`) to exclude parts of the repo. The usage comment suggests running from repo root, but the code doesn’t enforce it, so results can be silently wrong. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
