feat(core): add --convert-flow-to-block option#409
Draft
looztra wants to merge 2 commits into
Draft
Conversation
…elements to block style Closes #278. When --convert-flow-to-block (-b) is set, yamkix recursively walks the parsed YAML structure and calls fa.set_block_style() on any CommentedMap or CommentedSeq that was loaded in flow style, converting constructs like [a, b, c] and {key: val} to their block equivalents before the dump pass. https://claude.ai/code/session_01N1AMyP46KHiaVtprAKgNFh
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #409 +/- ##
==========================================
+ Coverage 95.90% 96.04% +0.13%
==========================================
Files 10 10
Lines 342 354 +12
Branches 58 63 +5
==========================================
+ Hits 328 340 +12
Misses 12 12
Partials 2 2 ☔ View full report in Codecov by Sentry. |
…k option (#410) $(cat <<'EOF' ## Summary - Adds `tests/data/source/flow-sequences-and-maps.yml` — a source fixture covering flow sequences, flow mappings, nested flow structures, and already-block-style content - Adds `tests/data/expected/flow-sequences-and-maps--convert-flow-to-block.yml` — expected output after applying `--convert-flow-to-block` - Adds `tests/data/expected/lists-and-maps-json-style--convert-flow-to-block.yml` — expected output for the existing JSON-style source with `--convert-flow-to-block` - Wires two new `pytest.param` entries into `TestNonRegression.test_config` in `tests/test_non_regression.py` Total test count: 172 → 174 (all passing). ## Test plan - [x] `uv run poe test` — 174 tests pass - [x] `uv run poe lint:all` — ruff, ty, pylint, pyright all clean https://claude.ai/code/session_01Q5mujYy8DSeij4XpXDJQV8 EOF ) --- _Generated by [Claude Code](https://claude.ai/code/session_01Q5mujYy8DSeij4XpXDJQV8)_ Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-b/--convert-flow-to-blockCLI flag that converts flow-style (JSON-style) sequences and mappings to block style during formattingconvert_flow_to_block_style()inhelpers.py— recursively walksCommentedMap/CommentedSeqnodes and callsset_block_style()on eachYamkixConfig,create_yamkix_config_from_typer_args(), andyamkix_dump_all()/round_trip_and_format()Test plan
tests/test_helpers.py— unit tests forconvert_flow_to_block_stylecovering sequences, mappings, nested structures, already-block-style inputs, and scalar pass-throughtests/test_yamkix.py— integration tests confirming flow→block conversion changes content (unchanged=False) and that block input with flag disabled stays unchangedtests/test_cli.py— verifiesconvert_flow_to_blockis passed through tocreate_yamkix_config_from_typer_argstests/test_config.py— verifies the flag is present inYamkixConfigand plumbed throughget_yamkix_config_from_default/create_yamkix_config_from_typer_argsruff,ty,pylint,pyright) all clean