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

Better error message for malformed usethis.description #961

Closed
hadley opened this issue Dec 16, 2019 · 4 comments · Fixed by #1059
Closed

Better error message for malformed usethis.description #961

hadley opened this issue Dec 16, 2019 · 4 comments · Fixed by #1059
Labels
description 📚 feature a feature request or enhancement

Comments

@hadley
Copy link
Member

hadley commented Dec 16, 2019

Might be worthwhile to save to a file and attempt to parse?

It's also particularly problematic because it causes create_package() to fail part way through, leaving you in a malformed state that you just have to blow away.

@jennybc
Copy link
Member

jennybc commented Dec 16, 2019

Any specifics on the nature of this malformed description?

@hadley
Copy link
Member Author

hadley commented Dec 16, 2019

Two mistakes so far:

  • Forgetting a closing parenthesis, so person(... doesn't parse
  • Not using the correct indentation so that one line of Authors@R is interpreted as a new field

@hadley hadley added description 📚 feature a feature request or enhancement labels Mar 14, 2020
@hadley
Copy link
Member Author

hadley commented Mar 17, 2020

We could also improve the situation by allowing a direct call to person() here, rather than being forced to wrap it in a string; format(person(), style = "R") generates the code we need.

@hadley
Copy link
Member Author

hadley commented Mar 17, 2020

Reprex:

library(usethis)

options(usethis.description = list("Authors@R" = "person('Hadley', 'Wickham'"))
create_package(tempfile())
#> ✔ Creating '/tmp/RtmpjerEGN/file12f3050812b9d/'
#> ✔ Setting active project to '/private/tmp/RtmpjerEGN/file12f3050812b9d'
#> ✔ Creating 'R/'
#> Error in fmt[[1]]: subscript out of bounds
#> ✔ Setting active project to '<no active project>'

Created on 2020-03-17 by the reprex package (v0.3.0)

hadley added a commit that referenced this issue Mar 17, 2020
* Move more logic into `use_description_defaults()`
* Convert person object into text
* Ensure that `tidy_desc()` always succeeds

Fixes #961
hadley added a commit that referenced this issue Mar 18, 2020
* Move more logic into `use_description_defaults()`
* Convert person object into text
* Ensure that `tidy_desc()` always succeeds

Fixes #961
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
description 📚 feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants