[ 
https://issues.apache.org/jira/browse/GROOVY-11958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18076213#comment-18076213
 ] 

ASF GitHub Bot commented on GROOVY-11958:
-----------------------------------------

codecov-commenter commented on PR #2487:
URL: https://github.com/apache/groovy/pull/2487#issuecomment-4319549835

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2487?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 67.1091%. Comparing base 
([`815e756`](https://app.codecov.io/gh/apache/groovy/commit/815e7566be4658a44956db4e303c61cf77421bf0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`13febd6`](https://app.codecov.io/gh/apache/groovy/commit/13febd6bff50e35b1cba43c92b333532456b33d8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 19 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2487/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2487?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2487        +/-   ##
   ==================================================
   + Coverage     67.0889%   67.1091%   +0.0202%     
   - Complexity      31588      31596         +8     
   ==================================================
     Files            1451       1451                
     Lines          122530     122499        -31     
     Branches        21996      21998         +2     
   ==================================================
   + Hits            82204      82208         +4     
   + Misses          33245      33209        -36     
   - Partials         7081       7082         +1     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2487?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/2487?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)
 | `81.9083% <100.0000%> (+0.2500%)` | :arrow_up: |
   
   ... and [2 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2487/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>




> Add SGM#findGroups/findAllGroups
> --------------------------------
>
>                 Key: GROOVY-11958
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11958
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> *findGroups* (first match with capture groups)
> Closest existing Groovy idiom:
> {code:groovy}
> def m = "New York, NY 10292-0098" =~ /(\d{5})-(\d{4})/
> def (all, zip, plus4) = m ? m[0] : [null, null, null]
> {code}
> With findGroups:
> {code:groovy}
> def (all, zip, plus4) = "New York, NY 
> 10292-0098".findGroups(/(\d{5})-(\d{4})/)
> {code}
> findGroups returns an empty list on no match, and Groovy's multi-assign pads 
> missing elements with null, so the ternary/Elvis guard disappears.
> *findAllGroups* (all matches with capture groups)
> Closest existing Groovy idiom (findAll with a closure couples match 
> extraction and transformation):
> {code:groovy}
> def pairs = input.findAll(/Type=(\w+) Price=([\d.]+)/) { all, t, p -> "$t:$p" 
> }
> {code}
> With findAllGroups:
> {code:groovy}
> def pairs = input.findAllGroups(/Type=(\w+) Price=([\d.]+)/).collect { all, 
> t, p -> "$t:$p" }
> {code}
> For a one-shot collect the existing findAll-with-closure form is shorter. 
> findAllGroups pays off when you want the raw capture data first and then 
> filter, take, groupBy, or iterate over it separately — the match step and the 
> transform step are decoupled. eachMatch with a closure is the side-effect 
> equivalent; findAll with a closure is the value-returning equivalent that 
> findAllGroups most directly parallels.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to