MCPcopy
hub / github.com/PatrickJS/awesome-cursorrules / checkReadmeStructure

Function checkReadmeStructure

scripts/check-awesome-list.mjs:51–78  ·  view source on GitHub ↗
(readme)

Source from the content-addressed store, hash-verified

49}
50
51function checkReadmeStructure(readme) {
52 const firstH2 = readme.match(/^##\s+(.+?)\s*$/m);
53 if (!firstH2 || firstH2[1] !== "Contents") {
54 failures.push("README Contents must be the first top-level section after the title, image, and description.");
55 }
56
57 const contents = extractSection(readme, "Contents");
58 if (!contents) {
59 failures.push("README must include a Contents section.");
60 } else {
61 for (const forbidden of ["Contributing", "Footnotes"]) {
62 const pattern = new RegExp(`\\[[^\\]]*${forbidden}[^\\]]*\\]\\(`, "i");
63 if (pattern.test(contents)) {
64 failures.push(`README Contents must not include the ${forbidden} section.`);
65 }
66 }
67
68 checkContentsHierarchy(readme, contents);
69 }
70
71 if (/^##\s+Licen[cs]e\b/im.test(readme)) {
72 failures.push("README must not include a License/Licence section; keep license details in the root LICENSE file.");
73 }
74
75 if (/\bSpringboot\b/i.test(stripLinkTargets(readme))) {
76 failures.push("README must spell Spring Boot as two words.");
77 }
78}
79
80function stripLinkTargets(markdown) {
81 return markdown.replace(/\]\([^)]*\)/g, "]()").replace(/\bsrc(set)?=\"[^\"]*\"/g, "");

Callers 1

checkReadmeFunction · 0.85

Calls 3

extractSectionFunction · 0.85
checkContentsHierarchyFunction · 0.85
stripLinkTargetsFunction · 0.85

Tested by

no test coverage detected