| 49 | } |
| 50 | |
| 51 | function validateNoInlineComments(lines: string[], ext: string): ValidationError[] { |
| 52 | const errors: ValidationError[] = []; |
| 53 | const isScriptLang = [".py", ".rb"].includes(ext); |
| 54 | const commentPrefix = isScriptLang ? "#" : "//"; |
| 55 | |
| 56 | for (let i = 2; i < lines.length; i++) { |
| 57 | const trimmed = lines[i].trim(); |
| 58 | if (trimmed.startsWith(commentPrefix) && !trimmed.startsWith("#!") && !trimmed.startsWith("#include")) { |
| 59 | errors.push({ |
| 60 | rule: "no-comments", |
| 61 | message: `Unauthorized comment found on line ${i + 1}: ${trimmed.substring(0, 80)}`, |
| 62 | line: i + 1, |
| 63 | }); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return errors; |
| 68 | } |
| 69 | |
| 70 | function validateAbstraction(lines: string[]): ValidationError[] { |
| 71 | const errors: ValidationError[] = []; |