Skip to content

Conversation

@egenn
Copy link
Collaborator

@egenn egenn commented Nov 19, 2025

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @egenn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a significant refactoring effort to enhance and standardize the package's text formatting and object representation utilities. The primary goal is to improve code maintainability and consistency by renaming a key formatting function, introducing more flexible padding options, and streamlining how S7 object names are displayed. These changes ensure a more uniform and robust approach to console output and internal string manipulation.

Highlights

  • Function Renaming: The show_ls function has been renamed to repr_ls across the codebase, including its exports, usages in various S7 repr methods, and associated documentation and tests. This change aims to improve clarity and consistency in function naming.
  • Text Formatting Enhancements: The core fmt and highlight text formatting functions now support an additional pad parameter, allowing for more flexible control over text indentation and presentation. This enhancement has been propagated to relevant calls throughout the package.
  • Standardized Message Coloring: Direct usage of bold(green(...)) for status messages has been replaced with bold(highlight(...)) to standardize the visual representation of important information across various utility functions like print.CheckData, read, dt_merge, and ddb_data.
  • Refactoring of S7 Name Representation: The repr_S7name and objcat functions have been refactored to simplify their parameter list (e.g., colors replaced by col, verbosity removed, prefix added) and streamline the internal logic for generating S7 class name representations.
  • Removal of Unused Utilities: The leftpad and printchar utility functions, which were no longer needed due to changes in text formatting logic, have been removed from the codebase.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@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 appears to be a significant refactoring effort focused on improving code consistency and maintainability. Key changes include renaming show_ls to repr_ls throughout the project for better S7 compatibility, centralizing text formatting for colors and padding by enhancing the fmt function, and simplifying the repr_S7name function. These changes are applied consistently across code, documentation, and tests. The refactoring is well-executed, but I've identified one minor issue where a function argument is not being used as intended.

@egenn
Copy link
Collaborator Author

egenn commented Nov 25, 2025

/gemini review

Copy link

@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 introduces several improvements and refactorings. The renaming of show_ls to repr_ls is a good change for clarity, though it is a breaking change for other packages in the ecosystem that might use this internal-but-exported function. The formatting functions have been enhanced, for example by adding a pad argument to fmt and highlight, which is a nice improvement. A new generic preprocessed has been added, which seems useful. I've found several instances where the new highlight function is redundantly wrapped in bold(). I've added comments with suggestions to remove the redundancy and in one case, to use the new pad argument for cleaner code.

Copilot AI review requested due to automatic review settings January 1, 2026 12:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements several refactoring improvements and API enhancements focused on code clarity, consistency, and maintainability. The changes include renaming functions for better naming conventions, removing unused code, standardizing styling functions, and adding new functionality for accessing preprocessed data.

Key changes:

  • Renamed show_ls() to repr_ls() to better reflect that it returns a string representation rather than printing
  • Replaced thin() with gray() and bold(green()) with highlight() for more semantic and consistent styling
  • Added new preprocessed() generic function to provide cleaner API access to preprocessed data from Preprocessor objects

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
DESCRIPTION Updated package version to 0.99.1005 and date to 2025-11-25
NAMESPACE Updated exports: removed show_ls, added repr_ls and preprocessed
R/00_S7_init.R Added new preprocessed() generic function definition
R/01_S7_Hyperparameters.R Updated function calls from show_ls() to repr_ls() and improved field documentation
R/02_S7_Metrics.R Replaced show_ls() calls with repr_ls()
R/03_S7_Preprocessor.R Added preprocessed() method for Preprocessor and updated show_ls() to repr_ls()
R/05_S7_Tuner.R Updated show_ls() to repr_ls()
R/06_S7_Supervised.R Clarified comment from "Refs & Res" to "References"
R/08_S7_ClusteringConfig.R Replaced show_ls() with repr_ls()
R/09_S7_Clustering.R Replaced show_ls() with repr_ls()
R/10_S7_DecompositionConfig.R Updated show_ls() to repr_ls()
R/11_S7_Decomposition.R Updated show_ls() to repr_ls()
R/14_S7_utils.R Replaced bold(green()) with highlight()
R/fmt.R Added pad parameter to fmt() and highlight(), changed gray() to use explicit hex color, refactored to use intermediate variable
R/msg.R Removed redundant gray() call in msgdatetime()
R/read.R Replaced bold(green()) with highlight() throughout
R/rtemis_color_system.R Reordered variable assignments (no functional change)
R/utils_art.R Replaced thin() with gray() for more semantic styling
R/utils_data.table.R Replaced bold(green()) with highlight() and show_ls() with repr_ls()
R/utils_duckdb.R Replaced bold(green()) with highlight()
R/utils_print.R Renamed show_ls() to repr_ls(), removed unused printchar() function, replaced thin() with gray()
R/utils_strings.R Updated function signature for repr_S7name() (replaced colors/verbosity with col/prefix), removed unused leftpad() function
man/fmt.Rd Added pad parameter to documentation
man/highlight.Rd Added pad parameter to documentation
man/preprocessed.Rd New documentation file for preprocessed() generic
man/repr_S7name.Rd Updated parameter documentation to reflect API changes
man/repr_ls.Rd Renamed from show_ls.Rd with updated references
tests/testthat/test_explain.R Changed train() call to use positional argument instead of named x parameter
tests/testthat/test_strings.R Updated all test references from show_ls() to repr_ls()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## GLMET Regression ----
mod_r_glmnet <- train(
x = datr_train,
datr_train,
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The parameter name x was removed from this train() call, making it a positional argument. However, other calls to train() in this file (lines 49 and 57) still use the named parameter x = datc2_train and x = datr_train. For consistency and clarity, all calls should use the same pattern. Consider either keeping x = datr_train or updating all other calls to match this positional style.

Suggested change
datr_train,
x = datr_train,

Copilot uses AI. Check for mistakes.
Comment on lines +390 to +392
method(preprocessed, Preprocessor) <- function(x) {
x@preprocessed
}
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The new preprocessed() generic function and its method for Preprocessor objects lack test coverage. Since other methods in the same file have comprehensive test coverage in tests/testthat/test_Preprocessor.R, consider adding a test case to verify that preprocessed(x) correctly returns the preprocessed data from a Preprocessor object.

Copilot uses AI. Check for mistakes.
@egenn egenn merged commit b69daa9 into main Jan 8, 2026
2 checks passed
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