Diagnose the DESCRIPTION Version Field
Source:R/diagnostics-description-fields.R
lab_version_format.RdFlags a Version with a leading-zero component or a suspiciously large one, mirroring CRAN's version_with_leading_zeroes and version_with_large_components incoming checks. A calendar-year component (e.g. a dated 2026.01 version) is exempt.
Arguments
- path
Character. Path to the package directory. Default:
".".- verbose
Logical. Print diagnostic output. Default:
TRUE.- desc
Optional pre-parsed
DESCRIPTION, as returned bybase::read.dcf(). Defaults to reading it frompath.
Value
checktor_check_result() with passed, issues, message.
Source
Writing R Extensions,
under "The DESCRIPTION file", says a Version is "a sequence of at
least two ... non-negative integers"; the
incoming check
flags a leading zero or an implausible value. See
vignette("check-sources", package = "checktor") for how every check maps to its
source.
See also
checktor(), which runs this and every other check.
Examples
pkg <- example_diagnose_scenario("description_examples/version_format_bad.txt",
show_content = FALSE)
lab_version_format(pkg, verbose = FALSE)$issues
#> [1] "Version has a component with a leading zero: 0.01.0"
unlink(pkg, recursive = TRUE)