Skip to content

Commit

Permalink
Merge pull request #36 from thalleslmF/pr-231
Browse files Browse the repository at this point in the history
improvements
  • Loading branch information
thallesfreitaszup authored Aug 2, 2021
2 parents f1c04b5 + 9e3f982 commit 5fb4285
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions licence.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ const fs = require("fs");
const util = require("util");
const chalk = require("chalk");
function hasCorrectCopyrightDate(copyrightFile, file, startDateLicense) {
const requiredDate = `Copyright ${startDateLicense}, ${new Date().getFullYear()}`
const currentYear = new Date().getFullYear()
let requiredDate = ''
if (startDateLicense < currentYear) {
requiredDate = `Copyright ${startDateLicense}, ${currentYear}`
} else {
requiredDate = `Copyright ${startDateLicense}`
}

return copyrightFile.includes(requiredDate)
}
Expand All @@ -39,7 +45,7 @@ async function openFile(name) {
}

async function checkLicenseFile(file, config, fd) {
let buffer = new Buffer(8000)
let buffer = Buffer.alloc(8000)
return await new Promise(
(resolve, reject) => {
fs.read(fd, buffer, 0, 8000, 0, (err) => {
Expand Down

0 comments on commit 5fb4285

Please sign in to comment.