Skip to content

Comments

Fix maintainability and style issues in R/readGedcom.R#133

Merged
smasongarrison merged 2 commits intomainfrom
copilot/fix-maintainability-style-issues
Feb 21, 2026
Merged

Fix maintainability and style issues in R/readGedcom.R#133
smasongarrison merged 2 commits intomainfrom
copilot/fix-maintainability-style-issues

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

Addresses 4 maintainability and 16 style issues flagged by CodeFactor in R/readGedcom.R.

Changes

  • seq_len(nrow(...)) instead of 1:nrow(...) in mapFAMS2parents and mapFAMC2parents1:0 produces c(1, 0), not an empty sequence, making the loop unsafe on empty data frames.

  • || instead of | in if() conditions in collapseNames| is vectorized and inappropriate for scalar conditional branching.

  • Removed explicit return() at function exits across 13 functions — replaced terminal return(x) with implicit x. Early/conditional return() calls are preserved.

  • Fixed continuation-line indentation in process_tag's multi-line if condition (4 → 8 spaces).

# Before
for (i in 1:nrow(df_temp)) { ... }
if (!all(is.na(df_temp$name_given_pieces)) | !all(is.na(df_temp$name_given))) { ... }
return(df_temp)

# After
for (i in seq_len(nrow(df_temp))) { ... }
if (!all(is.na(df_temp$name_given_pieces)) || !all(is.na(df_temp$name_given))) { ... }
df_temp
Original prompt

This section details on the original issue you should resolve

<issue_title>Fix 4 Maintainability, 16 Style issues in R\readGedcom.R</issue_title>
<issue_description>CodeFactor found multiple issues:

Use seq_len(nrow(...)) instead of 1:nrow(...), which is likely to be wrong in the empty edge case.

Use || in conditional expressions.

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

Indentation should be 8 spaces but is 4 spaces.

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix maintainability and style issues in readGedcom.R Fix maintainability and style issues in R/readGedcom.R Feb 21, 2026
Copilot AI requested a review from smasongarrison February 21, 2026 01:57
@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.39%. Comparing base (a46ed17) to head (ef2210f).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
R/readGedcom.R 95.23% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #133   +/-   ##
=======================================
  Coverage   84.39%   84.39%           
=======================================
  Files          30       30           
  Lines        4979     4979           
=======================================
  Hits         4202     4202           
  Misses        777      777           

☔ 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 smasongarrison marked this pull request as ready for review February 21, 2026 02:55
@smasongarrison smasongarrison merged commit d765031 into main Feb 21, 2026
10 checks passed
@smasongarrison smasongarrison deleted the copilot/fix-maintainability-style-issues branch February 21, 2026 02:55
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 4 Maintainability, 16 Style issues in R\readGedcom.R

2 participants