usethis icon indicating copy to clipboard operation
usethis copied to clipboard

`create_package()` checks the wrong name when using `fields` and "Package"

Open mmuurr opened this issue 2 years ago • 0 comments

  1. Create a directory that is not a valid package name, e.g. "my-test-directory".
  2. Now from within that directory, try to initialize a package using {usethis}:
    usethis::create_package(".", fields = list(Package = "valid.package.name"), check_name = TRUE)
    # Error: 'my-test-directory' is not a valid package name. To be allowed on CRAN, it should: ...
    

Setting check_name = FALSE allows the call to proceed correctly, and indeed the created DESCRIPTION file has the package name set correctly, too: Package: valid.package.name.

So, it appears check_name = TRUE ignores the case where the name is specified in the fields argument.

EDIT: behavior observed with {usethis} v2.1.6.

mmuurr avatar Jul 03 '22 03:07 mmuurr