* Clamp a comment's line numbers to valid diff ranges. * Returns the adjusted comment, or null if lines cannot be clamped.
(comment: Comment, validRanges: FileLineRanges)
| 127 | * Returns the adjusted comment, or null if lines cannot be clamped. |
| 128 | */ |
| 129 | function clampCommentToValidRange(comment: Comment, validRanges: FileLineRanges): Comment | null { |
| 130 | if (!comment.file || comment.line == null) { |
| 131 | return comment; |
| 132 | } |
| 133 | |
| 134 | const clamped = clampCommentLines(comment.file, comment.startLine, comment.line, validRanges); |
| 135 | |
| 136 | if (!clamped) { |
| 137 | // File not in diff - return null to convert to general comment |
| 138 | return null; |
| 139 | } |
| 140 | |
| 141 | return { |
| 142 | ...comment, |
| 143 | startLine: clamped.startLine, |
| 144 | line: clamped.line, |
| 145 | }; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Validate review-comment locations against the current PR diff. |
no test coverage detected
searching dependent graphs…