Skip to content

Comments

Fix style and maintainability issues in helpers_regression.R#55

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-maintainability-style-issues
Draft

Fix style and maintainability issues in helpers_regression.R#55
Copilot wants to merge 4 commits intomainfrom
copilot/fix-maintainability-style-issues

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

Addresses 26 CodeFactor findings in R/helpers_regression.R: long lines, oversized function name, explicit return() calls, and wrong scalar logical operators.

Changes

  • Line length: Wrapped 14 lines exceeding 120 chars in both doc comments and code blocks
  • Function rename: check_sibling_order_ram_optimized (34 chars) → check_sibling_order_ram to satisfy the 30-char name limit; call site updated
  • Implicit returns: Removed 8 explicit return() calls — R's implicit return makes these redundant per tidyverse style
  • Logical operators: ||| and &&& in scalar conditionals (if expressions should use short-circuit operators)
  • Tests added: New tests/testthat/test-helpers_regression.R with 8 tests covering the changed code paths in check_discord_errors, valid_ids, check_sibling_order_ram, and check_sibling_order_fast
# Before
if (base::sum(base::grepl(pair_identifiers[1], base::names(data))) == 0 | base::sum(...) == 0) {
if (!base::is.null(sex) & !base::is.null(race) && sex == race) {

# After
if (base::sum(base::grepl(pair_identifiers[1], base::names(data))) == 0 ||
  base::sum(base::grepl(pair_identifiers[2], base::names(data))) == 0) {
if (!base::is.null(sex) && !base::is.null(race) && sex == race) {
Original prompt

This section details on the original issue you should resolve

<issue_title>Fix 2 Maintainability, 24 Style issues in R\helpers_regression.R</issue_title>
<issue_description>CodeFactor found multiple issues last seen at c9493bd:

Use || in conditional expressions.

Use &amp;&amp; in conditional expressions.

Lines should not be more than 120 characters. This line is 132 characters.

Variable and function names should not be longer than 30 characters.

Lines should not be more than 120 characters. This line is 199 characters.

Use implicit return behavior; explicit return() is not needed.

Lines should not be more than 120 characters. This line is 236 characters.

Lines should not be more than 120 characters. This line is 122 characters.

Lines should not be more than 120 characters. This line is 141 characters.

Lines should not be more than 120 characters. This line is 140 characters.

Lines should not be more than 120 characters. This line is 138 characters.

Lines should not be more than 120 characters. This line is 195 characters.

Lines should not be more than 120 characters. This line is 176 characters.

Lines should not be more than 120 characters. This line is 147 characters.

Lines should not be more than 120 characters. This line is 149 characters.

Lines should not be more than 120 characters...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix maintainability and style issues in helpers_regression.R Fix style and maintainability issues in helpers_regression.R Feb 21, 2026
Copilot AI requested a review from smasongarrison February 21, 2026 02:00
Signed-off-by: Mason Garrison <garrissm@wfu.edu>
@smasongarrison smasongarrison force-pushed the copilot/fix-maintainability-style-issues branch from d6ee0ad to 2949700 Compare February 21, 2026 02:15
@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.25%. Comparing base (73f17f8) to head (c74bc14).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
+ Coverage   91.20%   92.25%   +1.04%     
==========================================
  Files           7        7              
  Lines         853      878      +25     
==========================================
+ Hits          778      810      +32     
+ Misses         75       68       -7     

☔ 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.

@smasongarrison
Copy link
Member

@copilot can you help improve the patch coverage by adding a couple of tests?

Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 21, 2026

@copilot can you help improve the patch coverage by adding a couple of tests?

Added tests/testthat/test-helpers_regression.R (commit c74bc14) with 8 tests covering the changed code paths:

  • check_discord_errors: invalid id, sex, and race columns; missing first pair identifier; missing second pair identifier (specifically exercising the || fix); sex == race equality (exercising the && fix)
  • valid_ids: duplicate id column triggers a warning and falls back to row-wise id
  • check_sibling_order_ram (fast = FALSE): NA outcome value stops with an error
  • check_sibling_order_fast (fast = TRUE): NA outcome value stops with an error

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.

Fix 2 Maintainability, 24 Style issues in R\helpers_regression.R

2 participants