← Back to Pull requests

DOCFIX: Update index() documentation with some code examples #17919

Merged
scottchiefbaker merged 1 files (14 lines) on Jul 17, 2020 19:48 UTC
View on GitHub
scottchiefbaker scottchiefbaker commented on Jun 30, 2020 18:26 UTC
Author

I'm a visual learner, and examples in documentation are really helpful. I added some examples to index() to help other people understand it better.

Diff: 14 lines (+14 / -0) across 1 files Reviewer: karenetheridge Review duration: 24561m
All Vouch review confidence checks passed
Residual risk 0.02 = Change Risk (0.19) × (1 − Review Confidence (0.90)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.19 · 14 lines diff across 1 files
0.19
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.88 · 4 substantive comment(s)
0.88
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
90%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.162
Real PR Conversation Timeline
5 items
karenetheridge karenetheridge commented on code on Jun 30, 2020 18:30 UTC
Code Review
pod/perlfunc.pod:1
@@ -3585,6 +3585,20 @@ respectively.  POSITION and the return value are based at zero.
 If the substring is not found, L<C<index>|/index STR,SUBSTR,POSITION>
 returns -1.
 
+Find characters or strings:
+
+    index("Perl is great", "P");     # Returns 0
+    index("Perl is great", "g");     # Returns 8
+    index("Perl is great", "great"); # Also returns 8
+
+Attempting to find something not there:
+
+    index("Perl is great", "Z"); # Returns -1 (not found)

could you indent the comment to the same column as the other comments?

karenetheridge karenetheridge commented on code on Jun 30, 2020 18:30 UTC
Code Review
pod/perlfunc.pod:1
@@ -3585,6 +3585,20 @@ respectively.  POSITION and the return value are based at zero.
 If the substring is not found, L<C<index>|/index STR,SUBSTR,POSITION>
 returns -1.
 
+Find characters or strings:
+
+    index("Perl is great", "P");     # Returns 0
+    index("Perl is great", "g");     # Returns 8
+    index("Perl is great", "great"); # Also returns 8
+
+Attempting to find something not there:
+
+    index("Perl is great", "Z"); # Returns -1 (not found)
+
+Using an offset to find the I<second> occurrence:
+
+    index("Perl is great", "e", 5); # Returns 10

and here too

scottchiefbaker scottchiefbaker commented on code on Jun 30, 2020 18:40 UTC
Code Review
pod/perlfunc.pod:1
@@ -3585,6 +3585,20 @@ respectively.  POSITION and the return value are based at zero.
 If the substring is not found, L<C<index>|/index STR,SUBSTR,POSITION>
 returns -1.
 
+Find characters or strings:
+
+    index("Perl is great", "P");     # Returns 0
+    index("Perl is great", "g");     # Returns 8
+    index("Perl is great", "great"); # Also returns 8
+
+Attempting to find something not there:
+
+    index("Perl is great", "Z"); # Returns -1 (not found)

I just updated the PR so all the comments are on the same column

scottchiefbaker scottchiefbaker commented on code on Jun 30, 2020 18:40 UTC
Code Review
pod/perlfunc.pod:1
@@ -3585,6 +3585,20 @@ respectively.  POSITION and the return value are based at zero.
 If the substring is not found, L<C<index>|/index STR,SUBSTR,POSITION>
 returns -1.
 
+Find characters or strings:
+
+    index("Perl is great", "P");     # Returns 0
+    index("Perl is great", "g");     # Returns 8
+    index("Perl is great", "great"); # Also returns 8
+
+Attempting to find something not there:
+
+    index("Perl is great", "Z"); # Returns -1 (not found)
+
+Using an offset to find the I<second> occurrence:
+
+    index("Perl is great", "e", 5); # Returns 10

I just updated the PR so all the comments are on the same column

Assignees
scottchiefbaker scottchiefbaker
Labels
risk: low confidence: 90% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 19.2% (LOW) · Higher = larger blast radius
19.2%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 90% · Lower = rushed or shallow review
90%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 2% · Safe to merge
2%
Repository