pharmaR / riskmetric

Metrics to evaluate the risk of R packages
https://pharmar.github.io/riskmetric/
Other
156 stars 29 forks source link

ignore incomplete final line #317

Closed paulie-of-punskas closed 8 months ago

paulie-of-punskas commented 8 months ago

Warning message is returned, when running "assess_has_news" on packages, that do not have empty line at the end of file:

image

I have tested it on packages "ini", "viridisLite". Below is the code for reproducing the warning messages.

# === load riskmetric library
library("riskmetric")
library("magrittr")

# === create testing environment
dir.create(paste0(tempdir(), "/test_riskmetric"))
dir.create(paste0(tempdir(), "/test_riskmetric/source"))
dir.create(paste0(tempdir(), "/test_riskmetric/library"))
dir.create(paste0(tempdir(), "/test_riskmetric/downloads"))

# === download and unpack files
pkgs <- c("viridisLite", "ini")

# === install packages
install.packages(pkgs, lib = paste0(tempdir(), "/test_riskmetric/library"))
list.files(paste0(tempdir(), "/test_riskmetric/library"), recursive = TRUE)

pkg_ref(x = paste0(tempdir(), "/test_riskmetric/library/", pkgs[1])) %>% 
  pkg_assess(assessments = riskmetric::all_assessments()["assess_has_news"]) %>% 
  pkg_score()

pkg_ref(x = paste0(tempdir(), "/test_riskmetric/library/", pkgs[2])) %>% 
  pkg_assess(assessments = riskmetric::all_assessments()["assess_has_news"]) %>% 
  pkg_score()

Simplest fix, would be to to use readLines(., warn = FALSE).

codecov-commenter commented 8 months ago

Codecov Report

Merging #317 (2d197a8) into master (31854ae) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head 2d197a8 differs from pull request most recent head 30f3f5e. Consider uploading reports for the commit 30f3f5e to get more accurate results

@@           Coverage Diff           @@
##           master     #317   +/-   ##
=======================================
  Coverage   61.85%   61.85%           
=======================================
  Files          66       66           
  Lines        1025     1025           
=======================================
  Hits          634      634           
  Misses        391      391           
Files Coverage Δ
R/pkg_ref_cache_news.R 76.92% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more