Skip to content

Experiment: Refactored formatting code#53

Draft
olehermanse wants to merge 1 commit intocfengine:mainfrom
olehermanse:main
Draft

Experiment: Refactored formatting code#53
olehermanse wants to merge 1 commit intocfengine:mainfrom
olehermanse:main

Conversation

@olehermanse
Copy link
Copy Markdown
Member

From Claude:

  1. Extracted named constants for repeated node type sets: INDENTED_TYPES, CLASS_GUARD_TYPES, BLOCK_TYPES
  2. Extracted format_block_header() — the bundle/body header formatting logic that was inline in autoformat
  3. Extracted needs_blank_line_before() — replaces the big if/elif chain for blank line insertion between children
  4. Extracted get_comment_indent() — the comment indentation logic
  5. Extracted is_empty_comment() — the bare # comment detection
  6. Simplified the single-line promise path in autoformat by reusing can_single_line_promise() instead of duplicating
    its logic inline

From Claude:

  1. Extracted named constants for repeated node type sets: INDENTED_TYPES, CLASS_GUARD_TYPES, BLOCK_TYPES
  2. Extracted format_block_header() — the bundle/body header formatting logic that was inline in autoformat
  3. Extracted needs_blank_line_before() — replaces the big if/elif chain for blank line insertion between children
  4. Extracted get_comment_indent() — the comment indentation logic
  5. Extracted is_empty_comment() — the bare # comment detection
  6. Simplified the single-line promise path in autoformat by reusing can_single_line_promise() instead of duplicating
  its logic inline

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
@olehermanse olehermanse changed the title Refactored formatting code Experiment: Refactored formatting code Apr 9, 2026
@olehermanse
Copy link
Copy Markdown
Member Author

This one is for review only, do not merge.

@olehermanse olehermanse added invalid This doesn't seem right wontfix This will not be worked on labels Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right wontfix This will not be worked on

Development

Successfully merging this pull request may close these issues.

1 participant