-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add documentation + bump version + linting #30
Add documentation + bump version + linting #30
Conversation
@@ -1,6 +1,6 @@ | |||
Package: nhsbsaShinyR | |||
Title: Template for NHSBSA {shiny} apps | |||
Version: 0.0.0.9002 | |||
Version: 0.0.0.9003 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always bump version
@@ -1,6 +1,8 @@ | |||
# Generated by roxygen2: do not edit by hand | |||
|
|||
export("%>%") | |||
export(accessible_action_link) | |||
export(accessible_radio_button) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are added by including @export
in the documentation sections, then running roxygen2::roxygenise()
.
#' accessible_radio_button | ||
#' | ||
#' @param ... radio content | ||
#' @inheritParams shiny::radioButtons |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easy way to get the parameter documentation from the shiny
function it is based off.
#' | ||
#' @noRd | ||
#' @return HTML | ||
#' @export |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the function is meant to be used outside the package itself (i.e. not an internal function), you have to include @export
. This will add it to the NAMESPACE
.
#' ), | ||
#' choiceValues = list( | ||
#' "A", "B", "C" | ||
#' )) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always include an example for exported functions.
#' choiceValues = list( | ||
#' "A", "B", "C" | ||
#' )) | ||
# Begin Exclude Linting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally we want to use snake_case for function and variable names. In this case we are basing the function off an existing one that uses camelCase, so makes sense to keep the original naming convention for clarity. Need to exclude linting then. Because the args are spread over several lines, easier to exclude the whole block, rather than individual lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, i will add to lintr to ignore camelCase.
if (inline) divClass <- paste(divClass, "shiny-input-container-inline") | ||
|
||
|
||
div_class <- "form-group shiny-input-radiogroup shiny-input-container" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just handles the lint for divClass
. Alternatively could have added # Exclude Linting
to each line divClass
appears on.
accessible_action_link <- function(inputId, label, icon = NULL, ...) { | ||
#' @examples | ||
#' accessible_action_link("infoLink", "Information Link", class = "btn-info") | ||
accessible_action_link <- function(inputId, label, icon = NULL, ...) { # Exclude Linting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, camelCase was picked up by lintr
. Here it is just an exclude line as no spread over multiple lines like for the radio buttons one.
#' "A", "B", "C" | ||
#' )) | ||
# Begin Exclude Linting | ||
accessible_radio_buttons <- function(inputId, label, choices = NULL, selected = NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note I added an "s" on function name, since usually we have multiple buttons ;)
No description provided.