Skip to content

Replace sapply() with vapply() for type safety#517

Open
utkarshpawade wants to merge 2 commits intostan-dev:masterfrom
utkarshpawade:refactor/sapply-to-vapply-type-safety
Open

Replace sapply() with vapply() for type safety#517
utkarshpawade wants to merge 2 commits intostan-dev:masterfrom
utkarshpawade:refactor/sapply-to-vapply-type-safety

Conversation

@utkarshpawade
Copy link
Copy Markdown
Contributor

Fixes #516

Summary

  • Replaces 9 uses of sapply() with vapply() across 5 files
  • vapply() enforces a declared return type, preventing silent list() returns on zero-length input that can cause hard to diagnose downstream failures
  • Two sapply(x, colnames) calls at helpers-mcmc.R:277,303 are intentionally unchanged, they rely on flexible return types to detect mismatched column names across chains

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.67%. Comparing base (94a2ac5) to head (0bb70dd).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #517   +/-   ##
=======================================
  Coverage   98.67%   98.67%           
=======================================
  Files          35       35           
  Lines        5903     5903           
=======================================
  Hits         5825     5825           
  Misses         78       78           

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

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.

Replace sapply() with vapply() for type safety

2 participants