Skip to content

Conversation

@jsiirola
Copy link
Member

@jsiirola jsiirola commented Jan 9, 2026

Fixes # .

Summary/Motivation:

This PR makes two fundamental changes to the StreamIndenter:

  • rely on (3) regular expressions to handle the indentation instead of breaking apart and piecing back together the strings
  • change the implementation so that nested StreamIndenter instances run with constant overhead (instead of linear in the number of nested indenters)

Changes proposed in this PR:

  • switch to using re for inserting the indentation
  • add improved special-case handling for blank lines (so that we do not add unnecessary whitespace into blank lines)
  • make nested indenters collect all indentation and then write directly to the underlying (unindented) output stream
  • improve testing

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.23%. Comparing base (168e961) to head (d5dd777).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3813      +/-   ##
==========================================
- Coverage   89.41%   89.23%   -0.19%     
==========================================
  Files         909      909              
  Lines      105579   105588       +9     
==========================================
- Hits        94408    94217     -191     
- Misses      11171    11371     +200     
Flag Coverage Δ
builders 29.12% <21.42%> (+<0.01%) ⬆️
default 86.04% <100.00%> (?)
expensive 35.76% <21.42%> (?)
linux 86.73% <100.00%> (-2.46%) ⬇️
linux_other 86.73% <100.00%> (+<0.01%) ⬆️
osx 82.88% <100.00%> (+<0.01%) ⬆️
win ?
win_other ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

1 participant