Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit a5a1bf3

Browse files
authored
remove sanitization code for now (#198)
1 parent 0fcb4ba commit a5a1bf3

File tree

2 files changed

+2
-72
lines changed

2 files changed

+2
-72
lines changed

dist/index.js

Lines changed: 1 addition & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/review.ts

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -867,57 +867,12 @@ function parseReview(
867867
let currentStartLine: number | null = null
868868
let currentEndLine: number | null = null
869869
let currentComment = ''
870-
871-
function removeLineNumbersFromSuggestion(comment: string): string {
872-
const suggestionStart = '```suggestion'
873-
const suggestionEnd = '```'
874-
let suggestionStartIndex = comment.indexOf(suggestionStart)
875-
876-
while (suggestionStartIndex !== -1) {
877-
const suggestionEndIndex = comment.indexOf(
878-
suggestionEnd,
879-
suggestionStartIndex
880-
)
881-
882-
if (suggestionEndIndex === -1) {
883-
// Break the loop if the closing delimiter is not found
884-
break
885-
}
886-
887-
const suggestionBlock = comment.substring(
888-
suggestionStartIndex + suggestionStart.length,
889-
suggestionEndIndex
890-
)
891-
const lineNumberRegex = /^\s*\d+:\s+/
892-
893-
const sanitizedBlock = suggestionBlock
894-
.split('\n')
895-
.map(line => line.replace(lineNumberRegex, ''))
896-
.join('\n')
897-
898-
comment =
899-
comment.substring(0, suggestionStartIndex + suggestionStart.length) +
900-
sanitizedBlock +
901-
comment.substring(suggestionEndIndex)
902-
903-
suggestionStartIndex = comment.indexOf(
904-
suggestionStart,
905-
suggestionEndIndex + suggestionEnd.length
906-
)
907-
}
908-
909-
return comment
910-
}
911-
912870
function storeReview(): void {
913871
if (currentStartLine !== null && currentEndLine !== null) {
914-
const sanitizedComment = removeLineNumbersFromSuggestion(
915-
currentComment.trim()
916-
)
917872
const review: Review = {
918873
start_line: currentStartLine,
919874
end_line: currentEndLine,
920-
comment: sanitizedComment.trim()
875+
comment: currentComment.trim()
921876
}
922877

923878
let within_patch = false

0 commit comments

Comments
 (0)