Skip to content

Replace dispEM with native warning/error and ravenList#659

Merged
edkerk merged 5 commits into
develop3from
feat/drop-dispEM
Jun 18, 2026
Merged

Replace dispEM with native warning/error and ravenList#659
edkerk merged 5 commits into
develop3from
feat/drop-dispEM

Conversation

@edkerk

@edkerk edkerk commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Add utils/ravenList.m: thin formatter that takes a header string and item list, returns header + newline + tab-indented items ready for warning()/error(). Trims to 10 items by default.
  • Rewrite queries/checkModelStruct.m: replace the evalc-based collect mode with a nested reportIssue(severity, msg, items) function that closes over throwErrors, trimWarnings, and the output issues array. The parseIssueText subfunction is removed.
  • Replace all dispEM call sites (317 calls across 67 files): dispEM(EM)error('RAVEN:badInput', ...), dispEM(EM, false)warning('RAVEN:warning', ...), with ravenList() for calls that pass an item list.
  • Delete utils/dispEM.m.
  • Update testing/function_tests/tUtils.m: replace the three dispEM-specific tests with three ravenList unit tests covering basic formatting, default trim, and explicit no-trim.

Motivation

dispEM had several problems: it used fprintf to print warnings (bypassing the MATLAB warning system and making warning('off', ...) ineffective), it threw MException('') with an empty ID (making errors uncatchable by category), it used textwrap with get(0,'CommandWindowSize') which crashes in headless mode, and checkModelStruct collected issues by calling itself recursively and parsing its own stdout.

Test plan

  • Run tUtils — all three ravenList tests pass
  • checkModelStruct(model) on a valid model — no output
  • checkModelStruct(model) on a model with issues — warnings/errors emitted
  • issues = checkModelStruct(model) — returns struct array without printing
  • warning('off', 'RAVEN:warning') suppresses advisory warnings

Drop the dispEM helper and replace all 317 call sites with native
MATLAB warning()/error() using the new ravenList() formatter:

- Add utils/ravenList.m: formats a header + tab-indented item list for
  passing to warning() or error(), with optional trim to 10 items.
- Rewrite queries/checkModelStruct.m: replace evalc-based collect mode
  with a nested reportIssue() function that closes over throwErrors,
  trimWarnings, and the output issues array. Removes parseIssueText.
- Replace dispEM(EM) calls with error('RAVEN:badInput', '%s', EM).
- Replace dispEM(EM, false) calls with warning('RAVEN:warning', '%s', EM).
- Replace dispEM(EM, false, list) with warning using ravenList(EM, list).
- Delete utils/dispEM.m.
- Update testing/function_tests/tUtils.m to test ravenList instead.
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

Function test results

206 tests   185 ✅  38s ⏱️
 22 suites   21 💤
  1 files      0 ❌

Results for commit 8a09516.

♻️ This comment has been updated with latest results.

edkerk added 4 commits June 18, 2026 08:36
ravenList: return header unchanged when items is empty, so callers
that pass an empty list do not crash in strjoin.

checkModelStruct/reportIssue: when called with three arguments and the
items list is empty, return silently (matches the original dispEM
behaviour where dispEM(msg, flag, {}) was a no-op). Without this guard,
checks that produce empty lists (e.g. the grRules start/end check when
no violations exist) incorrectly threw or warned with no items.
- tQueries/checkModelStructValidModel: drop verifyWarningFree. The old
  dispEM helper used fprintf (invisible to verifyWarningFree); advisory
  checks now issue proper MATLAB warnings via warning(), so the test
  expectation changes from no-warnings to no-thrown-error.

- checkModelStruct/reportIssue: tighten the silent-no-op comment.

- INIT/ftINIT.m: remove dead commented-out code block (flux-sanity
  check that was already disabled).

- reconstruction/guessComposition.m: remove two commented-out
  composition-mismatch warning blocks.
Removed comments about flux handling in reactions.
Contractions expanded (does not, cannot, will not, etc.), single-quoted
strings in doc-comment examples converted to double-quoted, possessives
reworded. Code lines and MATLAB transpose operators left untouched.
@edkerk edkerk merged commit 2b57db1 into develop3 Jun 18, 2026
4 checks passed
@edkerk edkerk deleted the feat/drop-dispEM branch June 18, 2026 07:39
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.

1 participant