Skip to content

Commit

Permalink
fix nolint syntax (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
chlebowa authored Feb 19, 2024
1 parent d497977 commit 9f8ea57
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 72 deletions.
10 changes: 5 additions & 5 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,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_linter
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.

teal::validate_has_data(ANL, 10)
validate(need(
Expand Down Expand Up @@ -376,7 +376,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_linter
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.

qenv <- teal.code::eval_code(
merged$anl_q_r(),
Expand All @@ -389,7 +389,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_linter
quote(ANL <- tidyr::drop_na(ANL, keep_columns)) # nolint: object_name.
)
}

Expand Down Expand Up @@ -611,7 +611,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_linter
ANL <- qenv[["ANL"]] # nolint: object_name.

resp_col <- as.character(merged$anl_input_r()$columns_source$response)
dat_cols <- as.character(merged$anl_input_r()$columns_source$dat)
Expand Down Expand Up @@ -707,7 +707,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
dev_labs <- list(color = varname_w_label(resp_col, ANL))

scales_biplot <-
if (is.character(response) || is.factor(response) || (is.numeric(response) && length(unique(response)) <= 6)) { # nolint line_length_linter
if (is.character(response) || is.factor(response) || (is.numeric(response) && length(unique(response)) <= 6)) { # nolint: line_length.
qenv <- teal.code::eval_code(
qenv,
quote(pca_rot$response <- as.factor(response))
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 @@ -312,7 +312,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_linter
ANL <- anl_merged_q()[["ANL"]] # nolint: object_name.
teal::validate_has_data(ANL, 10)

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

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

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

Expand Down
6 changes: 3 additions & 3 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ tm_g_association <- function(label = "Association",
show_association = TRUE,
plot_height = c(600, 400, 5000),
plot_width = NULL,
distribution_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), # nolint line_length_linter
association_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), # nolint line_length_linter
distribution_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), # nolint: line_length.
association_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), # nolint: line_length.
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args()) {
Expand Down Expand Up @@ -258,7 +258,7 @@ srv_tm_g_association <- function(id,
output_q <- reactive({
teal::validate_inputs(iv_r())

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

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

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

x_col_vec <- as.vector(merged$anl_input_r()$columns_source$x)
Expand Down Expand Up @@ -585,7 +585,7 @@ srv_g_bivariate <- function(id,
substitute(
expr = {
# Add facetting labels
# optional: grid.newpage() # nolint commented_code_linter
# optional: grid.newpage() # nolint: commented_code.
p <- add_facet_labels(p, xfacet_label = nulled_col_facet_name, yfacet_label = nulled_row_facet_name)
grid::grid.newpage()
grid::grid.draw(p)
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 @@ -493,7 +493,7 @@ srv_distribution <- function(id,
)
}

ANL <- merged$anl_q_r()[[as.character(dist_var[[1]]$dataname)]] # nolint object_name_linter
ANL <- merged$anl_q_r()[[as.character(dist_var[[1]]$dataname)]] # nolint: object_name.
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 @@ -533,7 +533,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_linter
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
dist_var <- merge_vars()$dist_var
s_var <- merge_vars()$s_var
g_var <- merge_vars()$g_var
Expand All @@ -560,7 +560,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_linter
expr = ANL[[g_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[g_var]]), "NA"), # nolint: object_name.
env = list(g_var = g_var)
)
)
Expand All @@ -576,7 +576,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_linter
expr = ANL[[s_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[s_var]]), "NA"), # nolint: object_name.
env = list(s_var = s_var)
)
)
Expand Down Expand Up @@ -994,7 +994,7 @@ srv_distribution <- function(id,
},
valueExpr = {
# Create a private stack for this function only.
ANL <- common_q()[["ANL"]] # nolint object_name_linter
ANL <- common_q()[["ANL"]] # nolint: object_name.

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 @@ -295,7 +295,7 @@ srv_g_response <- function(id,
teal::validate_inputs(iv_r())

qenv <- merged$anl_q_r()
ANL <- qenv[["ANL"]] # nolint object_name_linter
ANL <- qenv[["ANL"]] # nolint: object_name.
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 @@ -332,7 +332,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_linter
expr = ANL[[x]] <- with(ANL, forcats::fct_rev(x_cl)), # nolint: object_name.
env = list(x = x, x_cl = x_cl)
)
)
Expand All @@ -341,7 +341,7 @@ srv_g_response <- function(id,
qenv <- teal.code::eval_code(
qenv,
substitute(
expr = ANL[[resp_var]] <- factor(ANL[[resp_var]]), # nolint object_name_linter
expr = ANL[[resp_var]] <- factor(ANL[[resp_var]]), # nolint: object_name.
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 @@ -485,7 +485,7 @@ srv_g_scatterplot <- function(id,
)

trend_line_is_applicable <- reactive({
ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
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 @@ -512,7 +512,7 @@ srv_g_scatterplot <- function(id,

output$num_na_removed <- renderUI({
if (add_trend_line()) {
ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
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 @@ -536,7 +536,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_linter
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.

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 @@ -637,7 +637,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_linter
expr = ANL[, log_x_var] <- log_x_fn(ANL[, x_var]), # nolint: object_name.
env = list(
x_var = x_var,
log_x_fn = as.name(log_x_fn),
Expand All @@ -652,7 +652,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_linter
expr = ANL[, log_y_var] <- log_y_fn(ANL[, y_var]), # nolint: object_name.
env = list(
y_var = y_var,
log_y_fn = as.name(log_y_fn),
Expand Down Expand Up @@ -785,7 +785,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_linter
expr = ANL <- dplyr::filter(ANL, !is.na(x_var) & !is.na(y_var)), # nolint: object_name.
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 @@ -200,7 +200,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_linter
ANL <- qenv[["ANL"]] # nolint: object_name.

cols_names <- merged$anl_input_r()$columns_source$variables
alpha <- input$alpha
Expand All @@ -227,7 +227,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_linter
expr = ANL <- ANL[, cols_names] %>% # nolint: object_name.
dplyr::mutate_if(is.character, as.factor) %>%
droplevels(),
env = list(cols_names = cols_names)
Expand All @@ -237,7 +237,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_linter
expr = ANL <- ANL[, cols_names] %>% # nolint: object_name.
droplevels(),
env = list(cols_names = cols_names)
)
Expand Down Expand Up @@ -322,7 +322,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_linter
ANL <- merged$anl_q_r()[["ANL"]] # nolint: object_name.
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 @@ -425,22 +425,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_linter
expr = ANL <- anl_name[, selected_vars, drop = FALSE], # nolint: object_name.
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_linter
substitute(expr = ANL <- anl_name, env = list(anl_name = as.name(dataname))) # nolint: object_name.
)
}

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_linter
expr = ANL[[group_var]] <- anl_name[[group_var]], # nolint: object_name.
env = list(group_var = group_var, anl_name = as.name(dataname))
)
)
Expand Down Expand Up @@ -590,7 +590,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_linter
expr = ANL[[new_col_name]] <- ifelse(rowSums(is.na(ANL)) > 0, NA, FALSE), # nolint: object_name.
env = list(new_col_name = new_col_name)
)
)
Expand Down
Loading

0 comments on commit 9f8ea57

Please sign in to comment.