[
https://issues.apache.org/jira/browse/GROOVY-12133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18093784#comment-18093784
]
ASF GitHub Bot commented on GROOVY-12133:
-----------------------------------------
codecov-commenter commented on PR #2669:
URL: https://github.com/apache/groovy/pull/2669#issuecomment-4885414009
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2669?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
Report
:x: Patch coverage is `90.90909%` with `4 lines` in your changes missing
coverage. Please review.
:white_check_mark: Project coverage is 68.5739%. Comparing base
([`77ca2fa`](https://app.codecov.io/gh/apache/groovy/commit/77ca2fa03c32f16a909b9ceffa244e1832415328?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`e6fd013`](https://app.codecov.io/gh/apache/groovy/commit/e6fd0132b6e72412a911463312c97d86ae796277?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 4 commits behind head on master.
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2669?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Patch % | Lines |
|---|---|---|
|
[...java/org/codehaus/groovy/runtime/RegexSupport.java](https://app.codecov.io/gh/apache/groovy/pull/2669?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FRegexSupport.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvUmVnZXhTdXBwb3J0LmphdmE=)
| 90.4762% | [0 Missing and 4 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/2669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/2669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #2669 +/- ##
==================================================
+ Coverage 68.5684% 68.5739% +0.0055%
- Complexity 33800 33825 +25
==================================================
Files 1524 1524
Lines 128091 128212 +121
Branches 23283 23305 +22
==================================================
+ Hits 87830 87920 +90
- Misses 32467 32492 +25
- Partials 7794 7800 +6
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2669?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...g/codehaus/groovy/runtime/StringGroovyMethods.java](https://app.codecov.io/gh/apache/groovy/pull/2669?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FStringGroovyMethods.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvU3RyaW5nR3Jvb3Z5TWV0aG9kcy5qYXZh)
| `82.4627% <100.0000%> (+0.0437%)` | :arrow_up: |
|
[...java/org/codehaus/groovy/runtime/RegexSupport.java](https://app.codecov.io/gh/apache/groovy/pull/2669?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FRegexSupport.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvUmVnZXhTdXBwb3J0LmphdmE=)
| `88.8889% <90.4762%> (+8.8889%)` | :arrow_up: |
... and [11 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/2669/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests,
report on failures, and find test suite problems.
- :package: [JS Bundle
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save
yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
> Implement matchBalanced utility to support Regex Balanced Groups
> ----------------------------------------------------------------
>
> Key: GROOVY-12133
> URL: https://issues.apache.org/jira/browse/GROOVY-12133
> Project: Groovy
> Issue Type: Improvement
> Reporter: Daniel Sun
> Priority: Major
> Fix For: 6.0.0-beta-1
>
>
> *Context*
> Java's native regex engine lacks C#-style balanced group support (pushdown
> automaton). This makes parsing infinitely nested structures (e.g., nested
> parentheses, HTML tags, or code blocks) notoriously difficult, often leading
> to ReDoS (Regular Expression Denial of Service) vulnerabilities if solved
> purely via regex.
> *Proposed Solution*
> Introduce a highly optimized {{matchBalanced}} method. It should use a
> single-pass, stack-based scanner with dynamic subsumption (tail-absorption)
> to mimic C# balanced group behavior while guaranteeing O(N) performance.
> *Acceptance Criteria*
> * *Core Extraction:* Correctly extracts the outermost balanced groups from
> deeply nested strings (e.g., {{(A + (B * C))}} extracts the entire block).
> * *Fault Tolerance:* Gracefully handles malformed/dangling boundaries
> (unmatched open or close tags) without polluting the stack or crashing.
> * *Ignore Options:* Supports an {{ignoreRegex}} configuration to safely
> bypass escaped boundaries or string literals (e.g., ignoring {{"{}"}} inside
> quotes).
> * *Edge Stripping:* Supports an {{includeEdges}} configuration to optionally
> strip the outer boundary tags from the result.
> * *Performance:* Must guarantee strict O(N) time complexity. No
> backtracking, recursion, or expensive sorting operations are allowed.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)