Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow invalid CRAN names #883

Merged
merged 3 commits into from Sep 11, 2019
Merged

Allow invalid CRAN names #883

merged 3 commits into from Sep 11, 2019

Conversation

noamross
Copy link
Contributor

@noamross noamross commented Sep 8, 2019

  • stop_for_name controls whether to throw error
    for invalid CRAN package names
  • Default to warning for use_description(), error
    for create_package()
  • Add tests
  • update NEWS

I am unsure if stop_for_name is the best argument name, open to other suggestions!

Closes #528

- stop_for_name controls whether to throw error
  for invalid CRAN package names
- Default to warning for use_description(), error
  for create_package()
- Add tests
- update NEWS
Copy link
Member

@jennybc jennybc left a comment

The only other argument name that comes to mind -- somehow this seems more literally true -- is check_name. If we do that, it would make sense to change the doc string as well.

R/create.R Outdated Show resolved Hide resolved
R/description.R Show resolved Hide resolved
tests/testthat/test-use-description.R Outdated Show resolved Hide resolved
- Simplify check logic with elimination of warnings
- Update tests
- Re-document
R/description.R Outdated
@@ -97,17 +101,16 @@ build_description_list <- function(fields = list()) {
compact(utils::modifyList(defaults, fields))
}

check_package_name <- function(name) {
check_package_name <- function(name, stop_for_name) {
Copy link
Member

@jennybc jennybc Sep 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the signature can revert to just being name, right?

test_that("valid CRAN names checked", {
withr::local_options(list(usethis.description = NULL, devtools.desc = NULL))
scoped_temporary_package(dir = file_temp(pattern = "invalid_pkg_name"))
expect_error(use_description(check_name = FALSE), NA)
Copy link
Member

@jennybc jennybc Sep 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've got expect_error_free() for this (defined in tests/testthat/helper.R).

NEWS.md Outdated Show resolved Hide resolved
@jennybc
Copy link
Member

@jennybc jennybc commented Sep 11, 2019

Thanks!

@jennybc jennybc merged commit f76f8ff into r-lib:master Sep 11, 2019
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants