GuangchuangYu/badger

Question about commented-out code

wleoncio opened this issue · 0 comments

I was curious about why part of the code below is commented out:

badger/R/badge.R

Lines 56 to 77 in 01b6f5a

ver_devel <- function (pkg = NULL) {
## flag <- FALSE
## if (file.exists("DESCRIPTION")) {
## x <- readLines("DESCRIPTION")
## flag <- TRUE
## } else if (file.exists("../DESCRIPTION")) {
## x <- readLines("../DESCRIPTION")
## flag <- TRUE
## }
## if (flag) {
## y <- x[grep("^Version", x)]
## v <- sub("Version: ", "", y)
## if ((as.numeric(gsub("\\d+\\.(\\d+)\\.\\d+", "\\1", v))%%2) == 1) {
## return(v)
## }
## }
pkg <- currentGitHubRef(pkg)
ver <- tryCatch(desc::desc_get_field("Version"), error = function(e) NULL)
if (is.null(ver ))
ver <- check_github(pkg)$latest_version
return(ver)
}

It looks like an attempt to read the package version from a local DESCRIPTION, which sounds to me like a useful feature (instead of having the function always try to retrieve it from GitHub).