Skip to content

Split ValueConverter::Filter into one member per mode (0061) - #380

Merged
rmorozov merged 2 commits into
masterfrom
claude/project-thread-vwcz20
Oct 4, 2026
Merged

rmorozov merged 2 commits into
masterfrom
claude/project-thread-vwcz20

Conversation

@rmorozov

@rmorozov rmorozov commented Oct 4, 2026

Copy link
Copy Markdown
Member

Requested by Ruslan · project thread

Before: one function, ValueConverter::Filter in src/filters.cpp, implemented the int, float, abs, round, filesizeformat, items and list filters. Its cognitive complexity was 89, and it was kept behind a NOLINT marker.

After: each of those modes has its own private member, declared in src/filters.h: FileSizeFormat, Items, ToInt, ToFloat, Abs and Round. Two free helpers move into the file's anonymous namespace: PythonIntOf (bool counts as int) and FloatToInt. Filter now only switches on the mode. Output, error codes and the order in which errors are raised are all unchanged, and 29 complexity markers remain. Part of docs/tasks/0061.

Roles and rounds: main session plus one verifier round, which found nothing blocking.

  • The verifier rendered every filter, with and without arguments, over edge values in narrow and wide form under all four undefined policies. That came to about 354k output lines, byte-identical to the parent.
  • ASan and UBSan were clean. clang-tidy was clean on the changed lines and on filters.h analysed alone. clang-format was clean.
  • It found one difference from Python that predates this PR: abs(INT64_MIN) returns INT64_MIN.

Red pushes: 0 so far.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LJv5o6nbcd16qaXtwhoNVG


Generated by Claude Code

The int/float/abs/round/filesizeformat/items filters shared one
function with cognitive complexity 89. Each mode now has its own
private member; Filter dispatches. Behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJv5o6nbcd16qaXtwhoNVG
@rmorozov rmorozov self-assigned this Oct 4, 2026
@rmorozov
rmorozov marked this pull request as ready for review October 4, 2026 02:33
@rmorozov
rmorozov merged commit ce00bba into master Oct 4, 2026
39 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.

2 participants