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

Add documentation + bump version + linting #30

Merged

Conversation

MarkMc1089
Copy link
Contributor

No description provided.

@@ -1,6 +1,6 @@
Package: nhsbsaShinyR
Title: Template for NHSBSA {shiny} apps
Version: 0.0.0.9002
Version: 0.0.0.9003
Copy link
Contributor Author

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)
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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"
#' ))
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

Copy link
Contributor

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"
Copy link
Contributor Author

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
Copy link
Contributor Author

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,
Copy link
Contributor Author

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 ;)

@kygoffe kygoffe merged commit 7d56596 into 28-add-accessibility-favicon Nov 15, 2023
2 checks passed
@kygoffe
Copy link
Contributor

kygoffe commented Nov 15, 2023

closes issue #29, #30

@kygoffe kygoffe deleted the 28-add-accessibility-favicon-review branch November 15, 2023 16:07
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