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

start moving templates #1481

Closed
wants to merge 1 commit into from
Closed

start moving templates #1481

wants to merge 1 commit into from

Conversation

maelle
Copy link
Collaborator

@maelle maelle commented Feb 2, 2021

  • Move current templates to a folder called BS3.
  • Modified the code so that templates can be found there.
  • Added a copy of BS3 templates in a folder called BS4, for having a better diff when these become actual BS4 templates.

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

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

A few initial comments. This would also be easier to review without the new BS4 starter templates, so I'd suggest removing for now.

"docsearch",
ext = ".json",
bs_version = get_bs_version(pkg)
)
Copy link
Member

Choose a reason for hiding this comment

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

WS

Copy link
Member

Choose a reason for hiding this comment

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

And in function calls below


if (!is.null(template$bootstrap)) {
if (!template$bootstrap %in% c(3, 4)) {
stop("The Bootstrap version `bootstrap` has to be 3 or 4.", call. = FALSE)
Copy link
Member

Choose a reason for hiding this comment

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

Can you please follow https://style.tidyverse.org/error-messages.html ?

I think pkgdown uses rlang already, so please use abort() and then the error message should be a "must" statement, like "Boostrap version must be 3 or 4".

if (!is.null(template$bootstrap)) {
if (!template$bootstrap %in% c(3, 4)) {
stop("The Bootstrap version `bootstrap` has to be 3 or 4.", call. = FALSE)
}
Copy link
Member

Choose a reason for hiding this comment

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

I'd make this an else statement so the overall structure is like:

if (has_parameter) {
  if (parameter_ok) {

  } else {
   abort(....)
 } else {
  3
}

Then it's more clear that the else clause if is very simple, so I think it's clearer to flip the order so that the simplest case becomes an early exit:

if (is.null(template$bootstrap)) {
  return(3)
}

@maelle
Copy link
Collaborator Author

maelle commented Feb 8, 2021

Opened #1485 instead (but used the comments from here).

@maelle maelle closed this Feb 8, 2021
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