Skip to content

Skip comments in regex brace matching#573

Closed
tristanmanchester wants to merge 1 commit into
peteromallet:mainfrom
tristanmanchester:fix/regex-brace-matcher-skips-comments
Closed

Skip comments in regex brace matching#573
tristanmanchester wants to merge 1 commit into
peteromallet:mainfrom
tristanmanchester:fix/regex-brace-matcher-skips-comments

Conversation

@tristanmanchester
Copy link
Copy Markdown
Contributor

Summary

  • teach the regex-based brace matchers to skip /* ... */ and // ... comment regions before counting braces
  • apply the fix to the affected regex extractors: C#, C++, Dart (via the shared C# helper), and Rust
  • add regressions proving comment braces no longer truncate extracted function bodies

Testing

  • uv run --with pytest python -m pytest desloppify/languages/csharp/tests/test_csharp_parse_helpers.py desloppify/languages/cxx/tests/test_extractors.py desloppify/languages/rust/tests/test_extractors.py desloppify/languages/dart/tests/test_extractors.py

@peteromallet
Copy link
Copy Markdown
Owner

Thanks for the fix. I accepted the underlying issue, but implemented it with changes on this branch in cfaf256 rather than merging this PR directly.

Decision: IMPLEMENT_WITH_CHANGES. The fallback brace matchers now skip line and block comments for C#/C++/Dart, and Rust uses a nested block-comment depth counter so braces after an inner */ but before the outer */ are still ignored. I added regressions for the affected fallback extractors, including nested Rust comments.

Validation: PYENV_VERSION=3.11.11 python -m pytest desloppify/languages/csharp/tests/test_csharp_parse_helpers.py desloppify/languages/cxx/tests/test_extractors.py desloppify/languages/dart/tests/test_extractors.py desloppify/languages/rust/tests/test_extractors.py desloppify/languages/typescript/tests/test_ts_fixers.py -q

@peteromallet
Copy link
Copy Markdown
Owner

Closing as superseded by cfaf256 on the review branch.

@peteromallet peteromallet added the release:v1.0 Included in v1.0 label May 13, 2026
@peteromallet
Copy link
Copy Markdown
Owner

Thanks for the contribution. This is included in v1.0: https://github.com/peteromallet/desloppify/releases/tag/v1.0

peteromallet added a commit that referenced this pull request May 13, 2026
Record co-author trailers for PR authors included in the v1.0 release cycle so GitHub can associate release-cycle contribution credit with the tag.

Refs: #189, #484, #485, #486, #489, #493, #495, #529, #539, #573, #580, #581, #584, #585, #589, #602, #603

Co-authored-by: R. Desmond <134018026+0-CYBERDYNE-SYSTEMS-0@users.noreply.github.com>
Co-authored-by: AreboursTLS <77301936+AreboursTLS@users.noreply.github.com>
Co-authored-by: AugusteBalas <128148269+AugusteBalas@users.noreply.github.com>
Co-authored-by: Alex Price <2804025+awprice@users.noreply.github.com>
Co-authored-by: Klaus Agnoletti <24544601+klausagnoletti@users.noreply.github.com>
Co-authored-by: Koshi <18751916+koshimazaki@users.noreply.github.com>
Co-authored-by: Pietro <6080662+pietrondo@users.noreply.github.com>
Co-authored-by: raveinid <7130195+raveinid@users.noreply.github.com>
Co-authored-by: Ryan Gerstenkorn <4079939+RyanJarv@users.noreply.github.com>
Co-authored-by: ryexLLC <217349586+ryexLLC@users.noreply.github.com>
Co-authored-by: Maximilian Scholz <6530123+sims1253@users.noreply.github.com>
Co-authored-by: Tristan Manchester <108270628+tristanmanchester@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:v1.0 Included in v1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants