Skip to content

fix: resolve gDRstyle linting violations#76

Open
bczech wants to merge 5 commits into
mainfrom
GDR-1014
Open

fix: resolve gDRstyle linting violations#76
bczech wants to merge 5 commits into
mainfrom
GDR-1014

Conversation

@bczech
Copy link
Copy Markdown
Contributor

@bczech bczech commented May 18, 2026

Description

What changed?

Related JIRA issue: GDR-1014

  • Fix trailing whitespace and blank lines
  • Replace nrow/ncol with NROW/NCOL (undesirable_function_linter)
  • Fix paste_linter violations (paste0+collapse, toString, strrep, file.path)
  • Fix seq_linter violations (seq_along, seq_len)
  • Refactor functions exceeding cyclocomp limit of 25 (extract helper functions)
  • Fix test linters (yoda_test, expect_true_false)
  • Remove undesirable operators (|> pipes)

Why was it changed?

Updated gDRstyle linting rules require compliance across all gDR packages.

Checklist for sustainable code base

  • I added tests for any code changed/added
  • I added documentation for any code changed/added
  • I made sure naming of any new functions is self-explanatory and consistent

Logistic checklist

  • Package version bumped
  • Changelog updated

bczech added 2 commits May 14, 2026 17:41
Address lint violations from updated gDRstyle rules:
- Fix trailing whitespace and blank lines
- Replace nrow/ncol with NROW/NCOL
- Fix paste_linter (paste0+collapse, toString, strrep, file.path)
- Fix seq_linter (seq_along, seq_len)
- Refactor cyclocomp_linter violations (extract helper functions)
- Fix test linters (yoda, expect_true_false)
- Remove undesirable operators (|> pipes)
@bczech bczech requested a review from a team as a code owner May 18, 2026 08:17
@bczech bczech requested review from darsoo and j-smola and removed request for a team May 18, 2026 08:17
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request standardizes row counting by replacing nrow() with NROW() across several R files and performs general code cleanup, including the removal of trailing whitespace. Review feedback suggests simplifying the barcode generation logic in R/generate_data.R for better efficiency. Additionally, a change in the vignette from paste0 to paste was flagged as it introduces unwanted extra spaces in the output formatting.

Comment thread R/generate_data.R
add_data_replicates <- function(df_layout) {
df_layout_duplicates <- Reduce(rbind, list(df_layout)[rep(1, times = 3)])
barcode <- do.call(c, lapply(paste0("plate_", seq_len(3)), function(x) rep(x, nrow(df_layout))))
barcode <- do.call(c, lapply(paste0("plate_", seq_len(3)), function(x) rep(x, NROW(df_layout))))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The generation of the barcode vector can be simplified and made more efficient by using the each argument of the rep function. This avoids the overhead of lapply and do.call(c, ...) while producing the same result.

  barcode <- rep(paste0("plate_", seq_len(3)), each = NROW(df_layout))

Comment thread vignettes/gDRtestData.Rmd Outdated
```{r echo=FALSE}
yml_path <- system.file(package = "gDRtestData", "testdata", "synthetic_list.yml")
cat(paste0("* ", names(yaml::read_yaml(yml_path)), collapse = ", \n"), ".")
cat(paste("* ", names(yaml::read_yaml(yml_path)), collapse = ", \n"), ".")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Changing paste0 to paste here introduces an unwanted extra space between the bullet point "* " and the dataset name. This is because paste uses a single space as the default separator (sep = " "). Since the prefix string already ends with a space, the resulting output will have two spaces (e.g., "* dataset_name"). To maintain the original formatting while addressing linting concerns, you should use paste0 or explicitly set sep = "".

cat(paste0("* ", names(yaml::read_yaml(yml_path)), collapse = ", \n"), ".")

Copy link
Copy Markdown
Contributor

@gladkia gladkia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

3 participants