Skip to content

Commit

Permalink
Removes unnecessary # nolint after object_name_linter was changed (
Browse files Browse the repository at this point in the history
#703)

# Pull Request

<!--- Replace `#nnn` with your issue link for reference. -->

- Part of #624
- Extends ANL rule to allow `ANL_OUTLIERS` and others variables that are
prefixed with `ANL_` (in all caps)
  • Loading branch information
averissimo authored Mar 1, 2024
1 parent 4dea7f3 commit 92bdf31
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ linters: linters_with_defaults(
line_length_linter = line_length_linter(120),
cyclocomp_linter = NULL,
object_usage_linter = NULL,
object_name_linter = object_name_linter(styles = c("snake_case", "symbols"), regexes = c(ANL = "^ANL_?[0-9]*$", ADaM = "^r?AD[A-Z]{2,3}_?[0-9]*$"))
object_name_linter = object_name_linter(styles = c("snake_case", "symbols"), regexes = c(ANL = "^ANL_?[0-9A-Z_]*$", ADaM = "^r?AD[A-Z]{2,3}_?[0-9]*$"))
)
8 changes: 4 additions & 4 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
standardization <- input$standardization
center <- standardization %in% c("center", "center_scale")
scale <- standardization == "center_scale"
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
ANL <- merged$anl_q_r()[["ANL"]]

teal::validate_has_data(ANL, 10)
validate(need(
Expand Down Expand Up @@ -422,7 +422,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
standardization <- input$standardization
center <- standardization %in% c("center", "center_scale")
scale <- standardization == "center_scale"
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
ANL <- merged$anl_q_r()[["ANL"]]

qenv <- teal.code::eval_code(
merged$anl_q_r(),
Expand All @@ -435,7 +435,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
if (na_action == "drop") {
qenv <- teal.code::eval_code(
qenv,
quote(ANL <- tidyr::drop_na(ANL, keep_columns)) # nolint: object_name.
quote(ANL <- tidyr::drop_na(ANL, keep_columns))
)
}

Expand Down Expand Up @@ -657,7 +657,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
plot_biplot <- function(base_q) {
qenv <- base_q

ANL <- qenv[["ANL"]] # nolint: object_name.
ANL <- qenv[["ANL"]]

resp_col <- as.character(merged$anl_input_r()$columns_source$response)
dat_cols <- as.character(merged$anl_input_r()$columns_source$dat)
Expand Down
4 changes: 2 additions & 2 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ srv_a_regression <- function(id,

# sets qenv object and populates it with data merge call and fit expression
fit_r <- reactive({
ANL <- anl_merged_q()[["ANL"]] # nolint: object_name.
ANL <- anl_merged_q()[["ANL"]]
teal::validate_has_data(ANL, 10)

validate(need(is.numeric(ANL[regression_var()$response][[1]]), "Response variable should be numeric."))
Expand Down Expand Up @@ -546,7 +546,7 @@ srv_a_regression <- function(id,

plot_type_0 <- function() {
fit <- fit_r()[["fit"]]
ANL <- anl_merged_q()[["ANL"]] # nolint: object_name.
ANL <- anl_merged_q()[["ANL"]]

stopifnot(ncol(fit$model) == 2)

Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ srv_tm_g_association <- function(id,
output_q <- reactive({
teal::validate_inputs(iv_r())

ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
ANL <- merged$anl_q_r()[["ANL"]]
teal::validate_has_data(ANL, 3)

vars_names <- merged$anl_input_r()$columns_source$vars
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ srv_g_bivariate <- function(id,
output_q <- reactive({
teal::validate_inputs(iv_r())

ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
ANL <- merged$anl_q_r()[["ANL"]]
teal::validate_has_data(ANL, 3)

x_col_vec <- as.vector(merged$anl_input_r()$columns_source$x)
Expand Down
10 changes: 5 additions & 5 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ srv_distribution <- function(id,
)
}

ANL <- merged$anl_q_r()[[as.character(dist_var[[1]]$dataname)]] # nolint: object_name.
ANL <- merged$anl_q_r()[[as.character(dist_var[[1]]$dataname)]]
params <- get_dist_params(as.numeric(stats::na.omit(ANL[[dist_var2]])), input$t_dist)
params_vec <- round(unname(unlist(params)), 2)
params_names <- names(params)
Expand Down Expand Up @@ -558,7 +558,7 @@ srv_distribution <- function(id,
common_q <- reactive({
# Create a private stack for this function only.

ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
ANL <- merged$anl_q_r()[["ANL"]]
dist_var <- merge_vars()$dist_var
s_var <- merge_vars()$s_var
g_var <- merge_vars()$g_var
Expand All @@ -585,7 +585,7 @@ srv_distribution <- function(id,
qenv <- teal.code::eval_code(
qenv,
substitute(
expr = ANL[[g_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[g_var]]), "NA"), # nolint: object_name.
expr = ANL[[g_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[g_var]]), "NA"),
env = list(g_var = g_var)
)
)
Expand All @@ -601,7 +601,7 @@ srv_distribution <- function(id,
qenv <- teal.code::eval_code(
qenv,
substitute(
expr = ANL[[s_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[s_var]]), "NA"), # nolint: object_name.
expr = ANL[[s_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[s_var]]), "NA"),
env = list(s_var = s_var)
)
)
Expand Down Expand Up @@ -1024,7 +1024,7 @@ srv_distribution <- function(id,
},
valueExpr = {
# Create a private stack for this function only.
ANL <- common_q()[["ANL"]] # nolint: object_name.
ANL <- common_q()[["ANL"]]

dist_var <- merge_vars()$dist_var
s_var <- merge_vars()$s_var
Expand Down
6 changes: 3 additions & 3 deletions R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ srv_g_response <- function(id,
teal::validate_inputs(iv_r())

qenv <- merged$anl_q_r()
ANL <- qenv[["ANL"]] # nolint: object_name.
ANL <- qenv[["ANL"]]
resp_var <- as.vector(merged$anl_input_r()$columns_source$response)
x <- as.vector(merged$anl_input_r()$columns_source$x)

Expand Down Expand Up @@ -409,7 +409,7 @@ srv_g_response <- function(id,
qenv <- teal.code::eval_code(
qenv,
substitute(
expr = ANL[[x]] <- with(ANL, forcats::fct_rev(x_cl)), # nolint: object_name.
expr = ANL[[x]] <- with(ANL, forcats::fct_rev(x_cl)),
env = list(x = x, x_cl = x_cl)
)
)
Expand All @@ -418,7 +418,7 @@ srv_g_response <- function(id,
qenv <- teal.code::eval_code(
qenv,
substitute(
expr = ANL[[resp_var]] <- factor(ANL[[resp_var]]), # nolint: object_name.
expr = ANL[[resp_var]] <- factor(ANL[[resp_var]]),
env = list(resp_var = resp_var)
)
) %>%
Expand Down
12 changes: 6 additions & 6 deletions R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ srv_g_scatterplot <- function(id,
)

trend_line_is_applicable <- reactive({
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
ANL <- merged$anl_q_r()[["ANL"]]
x_var <- as.vector(merged$anl_input_r()$columns_source$x)
y_var <- as.vector(merged$anl_input_r()$columns_source$y)
length(x_var) > 0 && length(y_var) > 0 && is.numeric(ANL[[x_var]]) && is.numeric(ANL[[y_var]])
Expand All @@ -595,7 +595,7 @@ srv_g_scatterplot <- function(id,

output$num_na_removed <- renderUI({
if (add_trend_line()) {
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
ANL <- merged$anl_q_r()[["ANL"]]
x_var <- as.vector(merged$anl_input_r()$columns_source$x)
y_var <- as.vector(merged$anl_input_r()$columns_source$y)
if ((num_total_na <- nrow(ANL) - nrow(stats::na.omit(ANL[, c(x_var, y_var)]))) > 0) {
Expand All @@ -621,7 +621,7 @@ srv_g_scatterplot <- function(id,
output_q <- reactive({
teal::validate_inputs(iv_r(), iv_facet)

ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
ANL <- merged$anl_q_r()[["ANL"]]

x_var <- as.vector(merged$anl_input_r()$columns_source$x)
y_var <- as.vector(merged$anl_input_r()$columns_source$y)
Expand Down Expand Up @@ -724,7 +724,7 @@ srv_g_scatterplot <- function(id,
plot_q <- teal.code::eval_code(
object = plot_q,
code = substitute(
expr = ANL[, log_x_var] <- log_x_fn(ANL[, x_var]), # nolint: object_name.
expr = ANL[, log_x_var] <- log_x_fn(ANL[, x_var]),
env = list(
x_var = x_var,
log_x_fn = as.name(log_x_fn),
Expand All @@ -739,7 +739,7 @@ srv_g_scatterplot <- function(id,
plot_q <- teal.code::eval_code(
object = plot_q,
code = substitute(
expr = ANL[, log_y_var] <- log_y_fn(ANL[, y_var]), # nolint: object_name.
expr = ANL[, log_y_var] <- log_y_fn(ANL[, y_var]),
env = list(
y_var = y_var,
log_y_fn = as.name(log_y_fn),
Expand Down Expand Up @@ -872,7 +872,7 @@ srv_g_scatterplot <- function(id,
plot_q <- teal.code::eval_code(
plot_q,
substitute(
expr = ANL <- dplyr::filter(ANL, !is.na(x_var) & !is.na(y_var)), # nolint: object_name.
expr = ANL <- dplyr::filter(ANL, !is.na(x_var) & !is.na(y_var)),
env = list(x_var = as.name(x_var), y_var = as.name(y_var))
)
)
Expand Down
8 changes: 4 additions & 4 deletions R/tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab
teal::validate_inputs(iv_r())

qenv <- merged$anl_q_r()
ANL <- qenv[["ANL"]] # nolint: object_name.
ANL <- qenv[["ANL"]]

cols_names <- merged$anl_input_r()$columns_source$variables
alpha <- input$alpha
Expand All @@ -326,7 +326,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab
qenv <- teal.code::eval_code(
qenv,
substitute(
expr = ANL <- ANL[, cols_names] %>% # nolint: object_name.
expr = ANL <- ANL[, cols_names] %>%
dplyr::mutate_if(is.character, as.factor) %>%
droplevels(),
env = list(cols_names = cols_names)
Expand All @@ -336,7 +336,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab
qenv <- teal.code::eval_code(
qenv,
substitute(
expr = ANL <- ANL[, cols_names] %>% # nolint: object_name.
expr = ANL <- ANL[, cols_names] %>%
droplevels(),
env = list(cols_names = cols_names)
)
Expand Down Expand Up @@ -421,7 +421,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab
output$message <- renderText({
shiny::req(iv_r()$is_valid())
req(selector_list()$variables())
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
ANL <- merged$anl_q_r()[["ANL"]]
cols_names <- unique(unname(do.call(c, merged$anl_input_r()$columns_source)))
check_char <- vapply(ANL[, cols_names], is.character, logical(1))
if (any(check_char)) {
Expand Down
8 changes: 4 additions & 4 deletions R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -478,22 +478,22 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
teal.code::eval_code(
data(),
substitute(
expr = ANL <- anl_name[, selected_vars, drop = FALSE], # nolint: object_name.
expr = ANL <- anl_name[, selected_vars, drop = FALSE],
env = list(anl_name = as.name(dataname), selected_vars = selected_vars())
)
)
} else {
teal.code::eval_code(
data(),
substitute(expr = ANL <- anl_name, env = list(anl_name = as.name(dataname))) # nolint: object_name.
substitute(expr = ANL <- anl_name, env = list(anl_name = as.name(dataname)))
)
}

if (input$summary_type == "By Variable Levels" && !is.null(group_var) && !(group_var %in% selected_vars())) {
qenv <- teal.code::eval_code(
qenv,
substitute(
expr = ANL[[group_var]] <- anl_name[[group_var]], # nolint: object_name.
expr = ANL[[group_var]] <- anl_name[[group_var]],
env = list(group_var = group_var, anl_name = as.name(dataname))
)
)
Expand Down Expand Up @@ -645,7 +645,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
qenv <- teal.code::eval_code(
qenv,
substitute(
expr = ANL[[new_col_name]] <- ifelse(rowSums(is.na(ANL)) > 0, NA, FALSE), # nolint: object_name.
expr = ANL[[new_col_name]] <- ifelse(rowSums(is.na(ANL)) > 0, NA, FALSE),
env = list(new_col_name = new_col_name)
)
)
Expand Down
Loading

0 comments on commit 92bdf31

Please sign in to comment.