Skip to content

Refactor code, code readbility#434

Merged
strengejacke merged 7 commits into
mainfrom
refactor_code_202605
May 17, 2026
Merged

Refactor code, code readbility#434
strengejacke merged 7 commits into
mainfrom
refactor_code_202605

Conversation

@strengejacke

Copy link
Copy Markdown
Member

No description provided.

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

Copy link
Copy Markdown

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 refactors the plot.see_check_model function by introducing a new internal helper, .default_value, to handle attribute retrieval with default fallbacks. This change replaces repetitive manual null checks and direct attr() calls, streamlining the initialization of plot parameters. Review feedback suggests optimizing the implementation of the .default_value helper by using attr() directly instead of retrieving the entire attributes list and simplifying the logic using the %||% operator.

Comment thread R/utils.R Outdated
@codecov

codecov Bot commented May 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.10%. Comparing base (1e4b828) to head (c5caff6).
⚠️ Report is 33 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #434      +/-   ##
==========================================
+ Coverage   50.68%   55.10%   +4.41%     
==========================================
  Files          70       70              
  Lines        6282     6448     +166     
==========================================
+ Hits         3184     3553     +369     
+ Misses       3098     2895     -203     

☔ 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 May 17, 2026 10:51
@strengejacke

Copy link
Copy Markdown
Member Author

@gemini-code-assist review

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

Copy link
Copy Markdown

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 refactors plot.see_check_model to improve maintainability by centralizing attribute extraction and plot-triggering logic. It introduces a common_args list to standardize graphical parameters across diagnostic plots using do.call. A high-severity review comment warns that this refactoring may cause 'unused argument' errors if the target plotting functions do not explicitly support the newly passed parameters, such as size_point and linewidth.

Comment thread R/plot.check_model.R

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors plot.see_check_model() to reduce duplication: attribute extraction is consolidated through a new .default_value() helper, per-diagnostic guard conditions are extracted into a .should_plot() helper, and shared plotting arguments are bundled into a common_args list dispatched via do.call(). Adds explanatory comments and removes a few inline default-setting blocks that are now folded into the attribute extraction step.

Changes:

  • Adds .default_value() in R/utils.R to read an attribute or fall back to a default.
  • Refactors plot.see_check_model() to centralize attribute extraction, deduplicate per-plot argument lists via common_args + do.call(), and introduce .should_plot() to gate each diagnostic block.
  • Adds inline section/explanatory comments throughout and removes a stale # nolint comment in print.see_check_model().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
R/utils.R Adds .default_value() helper used to read attributes with a fallback.
R/plot.check_model.R Major readability refactor of plot.see_check_model(); introduces .should_plot() and common_args; adds new defaults via .default_value().
R/print.check_model.R Removes a stray # nolint comment; no functional change.

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

Comment thread R/plot.check_model.R
@strengejacke strengejacke merged commit b00e093 into main May 17, 2026
12 of 26 checks passed
@strengejacke strengejacke deleted the refactor_code_202605 branch May 17, 2026 11:10
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