MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / validateNoInlineComments

Function validateNoInlineComments

src/tools/propose-commit.ts:51–68  ·  view source on GitHub ↗
(lines: string[], ext: string)

Source from the content-addressed store, hash-verified

49}
50
51function 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
70function validateAbstraction(lines: string[]): ValidationError[] {
71 const errors: ValidationError[] = [];

Callers 1

proposeCommitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected