From ed425680d0a1dfb09156f86e799664f4cc250c62 Mon Sep 17 00:00:00 2001 From: Lais Portugal Date: Mon, 19 Aug 2024 14:50:58 +0100 Subject: [PATCH] Removing redundant comments --- rules/license-header.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rules/license-header.js b/rules/license-header.js index 525773d..ffe613b 100644 --- a/rules/license-header.js +++ b/rules/license-header.js @@ -31,17 +31,13 @@ module.exports = { return { Program: () => { const source = context.getSourceCode().getText(); - - // Check if either header is present const isNewFileHeaderPresent = source.indexOf(NEW_FILE_LICENSE_HEADER) !== -1; const isModifiedFileHeaderPresent = source.indexOf(MODIFIED_FILE_LICENSE_HEADER) !== -1; - const prefixLines = source.substring(0, Math.max(0, source.indexOf('\n'))).trim().split("\n"); const prefixLinesAreValid = prefixLines.every( (line) => line === "" || ALLOWED_PREFIX_LINES.includes(line) ); - // If neither header is present, treat it as a new file and add the full header if (!isNewFileHeaderPresent && !isModifiedFileHeaderPresent) { context.report({ message: "Missing license header for a new file", @@ -49,7 +45,6 @@ module.exports = { fix: (fixer) => fixer.insertTextBeforeRange([0, 0], NEW_FILE_LICENSE_HEADER + "\n\n"), }); } - // If a header is missing or invalid, treat it as a modified file and add the modified header else if (!prefixLinesAreValid || (isModifiedFileHeaderPresent && headerIndex === -1)) { context.report({ message: "Missing or incorrect license header for a modified file",