Skip to content

Commit

Permalink
Removing redundant comments
Browse files Browse the repository at this point in the history
  • Loading branch information
laisspportugal committed Aug 19, 2024
1 parent 555bc14 commit ed42568
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions rules/license-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,20 @@ module.exports = {
return {
Program: () => {
const source = context.getSourceCode().getText();

// Check if either header is present
const isNewFileHeaderPresent = source.indexOf(NEW_FILE_LICENSE_HEADER) !== -1;

Check failure on line 34 in rules/license-header.js

View workflow job for this annotation

GitHub Actions / test

Insert `⏎·········`
const isModifiedFileHeaderPresent = source.indexOf(MODIFIED_FILE_LICENSE_HEADER) !== -1;

Check failure on line 35 in rules/license-header.js

View workflow job for this annotation

GitHub Actions / test

Insert `⏎·········`

const prefixLines = source.substring(0, Math.max(0, source.indexOf('\n'))).trim().split("\n");

Check failure on line 36 in rules/license-header.js

View workflow job for this annotation

GitHub Actions / test

Replace `.substring(0,·Math.max(0,·source.indexOf('\n'))).trim()` with `⏎··········.substring(0,·Math.max(0,·source.indexOf("\n")))⏎··········.trim()⏎··········`
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",
loc: { start: 0, end: 0 },
fix: (fixer) => fixer.insertTextBeforeRange([0, 0], NEW_FILE_LICENSE_HEADER + "\n\n"),

Check failure on line 45 in rules/license-header.js

View workflow job for this annotation

GitHub Actions / test

Replace `·fixer.insertTextBeforeRange([0,·0],·NEW_FILE_LICENSE_HEADER·+·"\n\n"),` with `⏎··············fixer.insertTextBeforeRange(⏎················[0,·0],⏎················NEW_FILE_LICENSE_HEADER·+·"\n\n"`
});

Check failure on line 46 in rules/license-header.js

View workflow job for this annotation

GitHub Actions / test

Replace `});` with `····),`
}

Check failure on line 47 in rules/license-header.js

View workflow job for this annotation

GitHub Actions / test

Replace `········}·` with `··········});`
// If a header is missing or invalid, treat it as a modified file and add the modified header
else if (!prefixLinesAreValid || (isModifiedFileHeaderPresent && headerIndex === -1)) {

Check failure on line 48 in rules/license-header.js

View workflow job for this annotation

GitHub Actions / test

Replace `·else·if·(!prefixLinesAreValid·||·(isModifiedFileHeaderPresent·&&·headerIndex·===·-1)` with `·}·else·if·(⏎··········!prefixLinesAreValid·||⏎··········(isModifiedFileHeaderPresent·&&·headerIndex·===·-1)⏎········`

Check failure on line 48 in rules/license-header.js

View workflow job for this annotation

GitHub Actions / test

'headerIndex' is not defined
context.report({
message: "Missing or incorrect license header for a modified file",
Expand Down

0 comments on commit ed42568

Please sign in to comment.