Skip to content

Commit

Permalink
Merge pull request #90 from albersonmiranda/dev
Browse files Browse the repository at this point in the history
docs: Empty URL in README
  • Loading branch information
albersonmiranda authored Aug 26, 2024
2 parents bd6c745 + 2b4f834 commit cbec5f8
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
13 changes: 13 additions & 0 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,16 @@ set_rownames = function(vec) {

return(vec)
}

# check for empty URLs in a file
check_empty_urls <- function(file_path) {
content <- readLines(file_path)
# Regex to match empty URLs like [text]()
empty_url_pattern <- "\\[.*?\\]\\(\\s*\\)"

# Look for any lines that match the pattern
empty_urls <- grep(empty_url_pattern, content, value = TRUE)

# Return all found empty URLs
return(empty_urls)
}
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Friendly & Fast Input-Output Analysis <img src="man/figures/leontief.jpg" align=
[![R-universe](https://albersonmiranda.r-universe.dev/badges/fio)](https://albersonmiranda.r-universe.dev/fio)
[![R-CMD-check](https://github.com/albersonmiranda/fio/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/albersonmiranda/fio/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/albersonmiranda/fio/branch/main/graph/badge.svg)](https://app.codecov.io/gh/albersonmiranda/fio?branch=main)
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/fio)]()
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/fio)](https://CRAN.R-project.org/package=fio)
<!-- badges: end -->

`{fio}` (*Friendly Input-Output*) is a R package designed for input-output analysis, emphasizing usability for Excel users and performance. It includes an [RStudio Addin](https://rstudio.github.io/rstudioaddins/) and a suite of functions for straightforward import of input-output tables from Excel, either programmatically or directly from the clipboard.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ status](https://www.r-pkg.org/badges/version/fio)](https://CRAN.R-project.org/pa
[![R-CMD-check](https://github.com/albersonmiranda/fio/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/albersonmiranda/fio/actions/workflows/R-CMD-check.yaml)
[![Codecov test
coverage](https://codecov.io/gh/albersonmiranda/fio/branch/main/graph/badge.svg)](https://app.codecov.io/gh/albersonmiranda/fio?branch=main)
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/fio)]()
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/fio)](https://CRAN.R-project.org/package=fio)
<!-- badges: end -->

`{fio}` (*Friendly Input-Output*) is a R package designed for
Expand Down
11 changes: 10 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
- Fedora 37, 38, 39, 40; R and all dependencies installed from default repository (`dnf install`).
* All tests passed successfully, except macOS 13 (R-devel). Transitive dependency `fs` could not be installed due to a compilation error. The error is not related to `fio`. The error is being tracked in the following issue: [Compilation fail macOS 13 (R 4.5)](https://github.com/r-lib/fs/issues/467)

## Resubmission

This is a resubmission. In this version I have:

* Fixed empty URL in README.md.
* Added unit test for empty URLs in .Rd, .Rmd and .md files.

## CRAN requests

In this version I have addressed CRAN requests (e-mail received in 2024-08-23):

* Update messages in `msrv.R`:
Expand All @@ -23,4 +32,4 @@ In this version I have addressed CRAN requests (e-mail received in 2024-08-23):
- Evidence: Evidence of the fix can be found in the following CI run:
- [GitHub Actions - Rust-check](https://github.com/albersonmiranda/fio/actions/runs/10536150893)
- Job `no-install` for evidence that build fails when `cargo` and `rustc` are not found and install instructions are displayed along with the minimum version required.
- Job `msrv-lower` for evidence that build fails when `cargo` and `rustc` are found but the minimum version required is not met and an error message is displayed containing both installed and required Rust versions.
- Job `msrv-lower` for evidence that build fails when `cargo` and `rustc` are found but the minimum version required is not met and an error message is displayed containing both installed and required Rust versions.
16 changes: 16 additions & 0 deletions tests/testthat/test-empty-urls.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CRAN requires that URLs in the documentation are valid and not empty, including badges
test_that("No empty URLs in markdown files", {
# Specify the path to the package directory
package_path <- file.path(c(".", "man")) # Adjust this if your tests directory is nested

# Find all documentation files in the package directory
files <- list.files(package_path, pattern = "\\.Rmd$|\\.md$|\\.Rd$", recursive = TRUE, full.names = TRUE)

# Check each markdown file for empty URLs
for (file in files) {
empty_urls <- check_empty_urls(file)

# Expect no empty URLs in the file
expect_length(empty_urls, 0)
}
})

0 comments on commit cbec5f8

Please sign in to comment.