(readme)
| 49 | } |
| 50 | |
| 51 | function 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 | |
| 80 | function stripLinkTargets(markdown) { |
| 81 | return markdown.replace(/\]\([^)]*\)/g, "]()").replace(/\bsrc(set)?=\"[^\"]*\"/g, ""); |
no test coverage detected