From a99a79441a6322b56af17733d33839f961d4b206 Mon Sep 17 00:00:00 2001 From: NULLchimp <58362593+nullchimp@users.noreply.github.com> Date: Thu, 10 Jul 2025 01:34:05 +0200 Subject: [PATCH] Fixed advanced security warnings (#66) Refactors the frontmatter parsing logic in the README update script. Removes redundant checks and simplifies the state management for identifying frontmatter sections, improving code readability and maintainability. --- update-readme.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/update-readme.js b/update-readme.js index c05a65a..52d768a 100755 --- a/update-readme.js +++ b/update-readme.js @@ -189,7 +189,6 @@ function extractDescription(filePath) { // Parse frontmatter for description (for both prompts and instructions) const lines = content.split("\n"); let inFrontmatter = false; - let frontmatterEnded = false; // For multi-line descriptions let isMultilineDescription = false; @@ -201,14 +200,12 @@ function extractDescription(filePath) { if (line.trim() === "---") { if (!inFrontmatter) { inFrontmatter = true; - } else if (inFrontmatter && !frontmatterEnded) { - frontmatterEnded = true; - break; + continue; } - continue; + break; } - if (inFrontmatter && !frontmatterEnded) { + if (inFrontmatter) { // Check for multi-line description with pipe syntax (|) const multilineMatch = line.match(/^description:\s*\|(\s*)$/); if (multilineMatch) { @@ -221,7 +218,6 @@ function extractDescription(filePath) { if (isMultilineDescription) { // If the line has no indentation or has another frontmatter key, stop collecting if (!line.startsWith(" ") || line.match(/^[a-zA-Z0-9_-]+:/)) { - isMultilineDescription = false; // Join the collected lines and return return multilineDescription.join(" ").trim(); }