Skip to content

Fix CodeFactor maintainability and style issues in func_discord_data.R - #57

Merged
smasongarrison merged 3 commits into
mainfrom
copilot/fix-maintainability-style-issues-another-one
Feb 21, 2026
Merged

smasongarrison merged 3 commits into
mainfrom
copilot/fix-maintainability-style-issues-another-one

Conversation

Copilot AI commented Feb 21, 2026 •

Copy link
Copy Markdown
Contributor

Five maintainability and five style violations flagged by CodeFactor in R/func_discord_data.R.

Changes

  • Safe sequence iteration — replaced 1:nrow(...) with seq_len(nrow(...)) and 1:length(...) with seq_along(...) to avoid off-by-one errors on zero-length inputs:

    # Before
    for (i in 1:length(variables)) { ... }
    lapply(X = 1:nrow(data), ...)
    
    # After
    for (i in seq_along(variables)) { ... }
    lapply(X = seq_len(nrow(data)), ...)
  • Implicit returns — removed explicit return(output) / return(df) calls at function tails (lines 187, 191, 310) in favour of R's implicit return convention.

  • Indentation — corrected continuation-line indentation inside if (!valid_ids(...)) calls from 4 to 8 spaces (lines 109, 223).

Original prompt

This section details on the original issue you should resolve

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

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

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

Indentation should be 8 spaces but is 4 spaces.

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

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix maintainability and style issues in R func_discord_data.R Fix CodeFactor maintainability and style issues in func_discord_data.R Feb 21, 2026
Copilot AI requested a review from smasongarrison February 21, 2026 02:03
Comment thread R/func_discord_data.R Outdated
Signed-off-by: Mason Garrison <garrissm@wfu.edu>
@codecov

codecov Bot commented Feb 21, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #57   +/-   ##
=======================================
  Coverage   91.20%   91.20%           
=======================================
  Files           7        7           
  Lines         853      853           
=======================================
  Hits          778      778           
  Misses         75       75           

☔ 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:25
@smasongarrison
smasongarrison merged commit 86513d1 into main Feb 21, 2026
11 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.

Fix 5 Maintainability, 5 Style issues in R\func_discord_data.R

2 participants