From d91052b2c4e8c2cb973734eee94c04c81a10f636 Mon Sep 17 00:00:00 2001 From: wlandau Date: Wed, 13 Mar 2024 07:19:42 -0400 Subject: [PATCH 1/2] Add explicit check that each contributed file has exactly 1 line --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/review_pull_request.R | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index da057c4..2ff0126 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: r.releases.internals Title: Internal Infrastructure for An R Universe of Package Releases Description: Internal infrastructure for an R universe of package releases. -Version: 0.0.14 +Version: 0.0.15 License: MIT + file LICENSE URL: https://github.com/r-releases/r.releases.internals BugReports: https://github.com/r-releases/r.releases.internals/issues diff --git a/NEWS.md b/NEWS.md index e1617f9..9b0740b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# r.releases.internals 0.0.15 + +* Add explicit check that each contribution has only 1 line. + # r.releases.internals 0.0.14 * Allow terminating newline to be absent in URL contributions. diff --git a/R/review_pull_request.R b/R/review_pull_request.R index e7b79c1..2f839b4 100644 --- a/R/review_pull_request.R +++ b/R/review_pull_request.R @@ -63,6 +63,24 @@ review_pull_request <- function( return(invisible()) } name <- basename(file$filename) + if (file$additions != 1L) { + pull_request_defer( + owner = owner, + repo = repo, + number = number, + message = paste( + "Text file", + shQuote(name), + "in pull request", + number, + "has", + file$additions, + "lines. The file should have exactly 1 line", + "unless it contains custom JSON (which is uncommon)." + ) + ) + return(invisible()) + } if (!is_character_scalar(file$patch)) { pull_request_defer( owner = owner, From 3cc1d53b273875d3da6b97dc0f335d714c28ea3d Mon Sep 17 00:00:00 2001 From: wlandau Date: Wed, 13 Mar 2024 07:25:53 -0400 Subject: [PATCH 2/2] stronger message --- R/review_pull_request.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/review_pull_request.R b/R/review_pull_request.R index 2f839b4..d017670 100644 --- a/R/review_pull_request.R +++ b/R/review_pull_request.R @@ -75,7 +75,7 @@ review_pull_request <- function( number, "has", file$additions, - "lines. The file should have exactly 1 line", + "lines. The file must have exactly 1 line", "unless it contains custom JSON (which is uncommon)." ) )