Skip to content

Conversation

@strengejacke
Copy link
Member

Fixes #882

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @strengejacke, 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 improving code consistency and readability by harmonizing the primary argument name across the check_model() function and its specialized methods. The change from a generic x to a more descriptive model enhances clarity for users and developers, making the codebase easier to understand and maintain.

Highlights

  • Argument Renaming: The primary argument x in the check_model() function and its various S3 methods (e.g., check_model.default, check_model.stanreg) has been consistently renamed to model.
  • Documentation Update: Roxygen documentation and .Rd manual pages have been updated to reflect the new model argument name, ensuring consistency between code and documentation.
  • Internal Consistency: All internal calls within the check_model() family of functions that previously used x now correctly reference the model argument, maintaining functional integrity.
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
Contributor

@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 improves the consistency of the check_model() function family by renaming the primary argument from x to model. The changes are applied correctly across the function definitions, documentation, and internal function calls within R/check_model.R. This is a valuable refactoring that enhances code readability and predictability for users.

To further improve consistency across the package, as suggested by the pull request title "Harmonizing argument names for check_* functions", I recommend extending this harmonization to other check_* functions that still use x or object as the name for the model argument. For example, functions like check_collinearity(), check_normality(), and simulate_residuals() still use x, while check_predictions() uses object. Aligning these to use model would create a more uniform API across the entire package.

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 54.16667% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.61%. Comparing base (98f2f6a) to head (5bc1a7e).
⚠️ Report is 98 commits behind head on main.

Files with missing lines Patch % Lines
R/check_predictions.R 40.00% 6 Missing ⚠️
R/check_model.R 61.53% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #886      +/-   ##
==========================================
+ Coverage   61.90%   62.61%   +0.71%     
==========================================
  Files          89       93       +4     
  Lines        6641     8218    +1577     
==========================================
+ Hits         4111     5146    +1035     
- Misses       2530     3072     +542     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@strengejacke strengejacke requested a review from Copilot January 29, 2026 10:41
@strengejacke
Copy link
Member Author

@gemini-code-assist review

Copy link
Contributor

@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 improves consistency by renaming the primary argument to model in check_convergence, check_model, and check_predictions. This is a good step towards a more readable and maintainable API.

To make the harmonization more complete, you could consider extending this change to other check_* functions in the package (like check_collinearity, check_normality, etc.) that still use x as the argument for the model object.

I've added one specific comment regarding an internal function where the parameter name could also be updated for consistency within the file.

Copy link
Contributor

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 addresses easystats consistency by harmonizing the primary argument name for several check_* functions to use model instead of x/object (Fixes #882).

Changes:

  • Renamed the first argument of check_model(), check_predictions(), and check_convergence() to model.
  • Updated S3 method signatures to align with the new model argument naming.
  • Updated .Rd documentation to reflect the renamed arguments.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
R/check_predictions.R Renames objectmodel in exported generic and methods.
R/check_model.R Renames xmodel in exported generic and methods.
R/check_convergence.R Renames xmodel in exported function signature.
man/check_predictions.Rd Updates usage/arguments from objectmodel.
man/check_model.Rd Updates usage/arguments from xmodel.
man/check_convergence.Rd Updates usage/arguments from xmodel.
Comments suppressed due to low confidence (1)

man/check_convergence.Rd:16

  • The documentation says ... is "Currently not used", but the implementation forwards ... to insight::is_converged(). Please update the ... argument description to reflect that it is passed through (or stop forwarding it if it truly shouldn’t be used).
check_convergence(model, tolerance = 0.001, ...)
}
\arguments{
\item{model}{A \code{merMod} or \code{glmmTMB}-object.}

\item{tolerance}{Indicates up to which value the convergence result is
accepted. The smaller \code{tolerance} is, the stricter the test will be.}

\item{...}{Currently not used.}
}

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

@strengejacke
Copy link
Member Author

@profandyfield In your book, do you name the first argument in check_model(), check_convergence() or check_predictions()? E.g., do you have examples where you write performance::check_model(x = my_model, ...) instead of performance::check_model(my_model, ...)? If so, I would for now ignore this PR, to avoid breaking changes with the code in your forthcoming book.

@profandyfield
Copy link

I've just done a search for check_model() within the manuscript and it seems like I never name the first argument (which is unintentionally inconsistent with what I do with other functions, but is probably because I never use or explain the other arguments), so this change won't break anything.

@strengejacke
Copy link
Member Author

Great, thanks!

@strengejacke strengejacke requested a review from Copilot January 30, 2026 07:42
@strengejacke
Copy link
Member Author

@gemini-code-assist review

Copy link
Contributor

@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 harmonizes argument names across several check_* functions, which improves consistency. I've found a few critical issues with the implementation of the backward compatibility for deprecated arguments, which could lead to errors when users call the functions with the old argument names. I've also suggested adding model validation checks for increased robustness in a few places. Please see my detailed comments.

Copy link
Contributor

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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.


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

@strengejacke strengejacke merged commit c05ee00 into main Jan 30, 2026
15 of 23 checks passed
@strengejacke strengejacke deleted the strengejacke/issue882 branch January 30, 2026 09:38
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.

Harmonizing argument names for check_* functions

3 participants