Skip to content

Commit

Permalink
fix paste0 lints with flint
Browse files Browse the repository at this point in the history
  • Loading branch information
rempsyc committed Dec 13, 2024
1 parent 39409c8 commit c8a802d
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 21 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ tests\^spelling
^WIP/.
\.code-workspace$
^CRAN-SUBMISSION$


# flint files
^flint$
8 changes: 4 additions & 4 deletions R/cite_easystats.R
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ cite_easystats <- function(packages = "easystats",
ref_packages[length(ref_packages)]
)
ref_packages[[2]] <- split(ref_packages[[2]], cumsum(ref_packages[[2]] == ""))

Check warning on line 348 in R/cite_easystats.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/cite_easystats.R,line=348,col=58,[nzchar_linter] Use !nzchar(x) instead of x == "". Note that unlike nzchar(), EQ coerces to character, so you'll have to use as.character() if x is a factor. Whenever missing data is possible, please take care to use nzchar(., keepNA = TRUE); nzchar(NA) is TRUE by default.

Check warning on line 348 in R/cite_easystats.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/cite_easystats.R,line=348,col=58,[nzchar_linter] Use !nzchar(x) instead of x == "". Note that unlike nzchar(), EQ coerces to character, so you'll have to use as.character() if x is a factor. Whenever missing data is possible, please take care to use nzchar(., keepNA = TRUE); nzchar(NA) is TRUE by default.
ref_packages.index <- grep(paste0("id: ((", paste0(packages, collapse = ")|("), "))"), ref_packages[[2]])
ref_packages.index <- grep(paste0("id: ((", paste(packages, collapse = ")|("), "))"), ref_packages[[2]])
ref_packages[[2]] <- unlist(ref_packages[[2]][ref_packages.index], use.names = FALSE)
ref_packages <- paste0(unlist(ref_packages, use.names = FALSE), collapse = "\n")
ref_packages <- paste(unlist(ref_packages, use.names = FALSE), collapse = "\n")
} else {
ref_packages <- readLines(system.file("easystats_bib.bib", package = "report"))
ref_packages[ref_packages == " version = {%s}"] <- sprintf(
Expand All @@ -365,10 +365,10 @@ cite_easystats <- function(packages = "easystats",
ref_packages <- split(ref_packages, cumsum(ref_packages == ""))

Check warning on line 365 in R/cite_easystats.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/cite_easystats.R,line=365,col=48,[nzchar_linter] Use !nzchar(x) instead of x == "". Note that unlike nzchar(), EQ coerces to character, so you'll have to use as.character() if x is a factor. Whenever missing data is possible, please take care to use nzchar(., keepNA = TRUE); nzchar(NA) is TRUE by default.

Check warning on line 365 in R/cite_easystats.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/cite_easystats.R,line=365,col=48,[nzchar_linter] Use !nzchar(x) instead of x == "". Note that unlike nzchar(), EQ coerces to character, so you'll have to use as.character() if x is a factor. Whenever missing data is possible, please take care to use nzchar(., keepNA = TRUE); nzchar(NA) is TRUE by default.
ref_packages.index <- grep(paste0(
"((article)|(software))\\{((",
paste0(packages, collapse = ")|("), "))"
paste(packages, collapse = ")|("), "))"
), ref_packages)
ref_packages <- unlist(ref_packages[ref_packages.index], use.names = FALSE)
ref_packages <- paste0(unlist(ref_packages, use.names = FALSE), collapse = "\n")
ref_packages <- paste(unlist(ref_packages, use.names = FALSE), collapse = "\n")
}


Expand Down
2 changes: 1 addition & 1 deletion R/format_formula.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
#' @export
format_formula <- function(x, what = "conditional") {
f <- insight::safe_deparse(insight::find_formula(x, verbose = FALSE)[[what]])
paste0("formula: ", paste0(f, collapse = " + "))
paste0("formula: ", paste(f, collapse = " + "))
}
4 changes: 2 additions & 2 deletions R/report.bayesfactor_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ report_text.bayesfactor_inclusion <- function(x,
bf_text <- paste0(
"Bayesian model averaging (BMA) was used to obtain the average evidence ",
"for each predictor. We found ",
paste0(
paste(
paste0(bf_results$evidence, " including ", bf_results$Term),
collapse = "; "
), "."
Expand Down Expand Up @@ -349,7 +349,7 @@ report_text.bayesfactor_inclusion <- function(x,
bf_explain,
paste0(
"We found ",
paste0(
paste(
paste0(
bf_results$evidence, " including ", bf_results$Term,
", with models including ", bf_results$Term,
Expand Down
4 changes: 2 additions & 2 deletions R/report.character.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ report_text.character <- function(x,
...
)

text <- paste0(summary(params), collapse = "; ")
text <- paste(summary(params), collapse = "; ")
if (nrow(entries) > 1) {
text <- paste0(name, ": ", nrow(entries), " entries, such as ", text)
} else {
Expand Down Expand Up @@ -198,5 +198,5 @@ report_statistics.character <- function(x,
text <- paste0(entries$Entry, ", n = ", entries$n_Entry)
}

as.report_statistics(paste0(text, collapse = "; "), summary = paste0(text[1:n_entries], collapse = "; "))
as.report_statistics(paste(text, collapse = "; "), summary = paste(text[1:n_entries], collapse = "; "))
}
2 changes: 1 addition & 1 deletion R/report.estimate_contrasts.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ report_text.estimate_contrasts <- function(x, table = NULL, ...) {
collapse = ". "
)

text <- paste("The marginal contrasts analysis suggests the following.", paste0(text, collapse = ""))
text <- paste("The marginal contrasts analysis suggests the following.", paste(text, collapse = ""))

as.report_text(text)
}
2 changes: 1 addition & 1 deletion R/report.factor.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ report_statistics.factor <- function(x, table = NULL, levels_percentage = "auto"
)
}

as.report_statistics(paste0(text_full, collapse = "; "), summary = paste0(text, collapse = "; "))
as.report_statistics(paste(text_full, collapse = "; "), summary = paste(text, collapse = "; "))
}

#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/report.stanreg.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ report_priors.stanreg <- function(x, ...) {
)
)

values <- paste0(values, collapse = "; ")
values <- paste(values, collapse = "; ")
values <- paste0(params$Prior_Distribution, " (", values, ")")

if (length(unique(values)) == 1 && nrow(params) > 1) {
Expand Down
2 changes: 1 addition & 1 deletion R/report_effectsize.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ print.report_effectsize <- function(x, ...) {
cat(attributes(x)$rules, "\n\n")
}

cat(paste0(x, collapse = "\n"))
cat(paste(x, collapse = "\n"))
}


Expand Down
2 changes: 1 addition & 1 deletion R/report_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ summary.report_info <- function(object, ...) {

#' @export
print.report_info <- function(x, ...) {
cat(paste0(x, collapse = "\n"))
cat(paste(x, collapse = "\n"))
}


Expand Down
2 changes: 1 addition & 1 deletion R/report_intercept.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ summary.report_intercept <- function(object, ...) {

#' @export
print.report_intercept <- function(x, ...) {
cat(paste0(x, collapse = "\n"))
cat(paste(x, collapse = "\n"))
}


Expand Down
2 changes: 1 addition & 1 deletion R/report_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ summary.report_model <- function(object, ...) {

#' @export
print.report_model <- function(x, ...) {
cat(paste0(x, collapse = "\n"))
cat(paste(x, collapse = "\n"))
}
4 changes: 2 additions & 2 deletions R/report_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ as.character.report_parameters <- function(x, prefix = NULL, ...) {

# Concatenate
text <- paste0(prefix, x)
text <- paste0(text, collapse = "\n")
text <- paste(text, collapse = "\n")
text
}

Expand Down Expand Up @@ -125,7 +125,7 @@ print.report_parameters <- function(x, ...) {
# Interaction
if (grepl(" * ", names[i], fixed = TRUE)) {
parts <- unlist(strsplit(names[i], " * ", fixed = TRUE))
basis <- paste0(utils::head(parts, -1), collapse = " * ")
basis <- paste(utils::head(parts, -1), collapse = " * ")
names[i] <- paste0("The interaction effect of ", utils::tail(parts, 1), " on ", basis)

# Intercept
Expand Down
2 changes: 1 addition & 1 deletion R/report_priors.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ summary.report_priors <- function(object, ...) {

#' @export
print.report_priors <- function(x, ...) {
cat(paste0(x, collapse = "\n"))
cat(paste(x, collapse = "\n"))
}
2 changes: 1 addition & 1 deletion R/report_random.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ summary.report_random <- function(object, ...) {

#' @export
print.report_random <- function(x, ...) {
cat(paste0(x, collapse = "\n"))
cat(paste(x, collapse = "\n"))
}
2 changes: 1 addition & 1 deletion R/report_statistics.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ summary.report_statistics <- summary.report_parameters

#' @export
print.report_statistics <- function(x, ...) {
cat(paste0(x, collapse = "\n"))
cat(paste(x, collapse = "\n"))
}

0 comments on commit c8a802d

Please sign in to comment.