MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / sanitizeLine

Function sanitizeLine

src/utils/swift-test-discovery.ts:23–83  ·  view source on GitHub ↗
(input: string, state: SanitizerState)

Source from the content-addressed store, hash-verified

21}
22
23function sanitizeLine(input: string, state: SanitizerState): string {
24 let output = '';
25
26 for (let index = 0; index < input.length; index += 1) {
27 const current = input[index];
28 const next = input[index + 1] ?? '';
29 const triple = input.slice(index, index + 3);
30
31 if (state.inBlockComment) {
32 if (current === '*' && next === '/') {
33 state.inBlockComment = false;
34 index += 1;
35 }
36 continue;
37 }
38
39 if (state.inMultilineString) {
40 if (triple === '"""') {
41 state.inMultilineString = false;
42 index += 2;
43 }
44 continue;
45 }
46
47 if (triple === '"""') {
48 state.inMultilineString = true;
49 index += 2;
50 continue;
51 }
52
53 if (current === '/' && next === '*') {
54 state.inBlockComment = true;
55 index += 1;
56 continue;
57 }
58
59 if (current === '/' && next === '/') {
60 break;
61 }
62
63 if (current === '"') {
64 output += ' ';
65 index += 1;
66 while (index < input.length) {
67 if (input[index] === '\\') {
68 index += 2;
69 continue;
70 }
71 if (input[index] === '"') {
72 break;
73 }
74 index += 1;
75 }
76 continue;
77 }
78
79 output += current;
80 }

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected