From 3105d5a20f2effd97844a576db89e500a4deaf3d Mon Sep 17 00:00:00 2001 From: Roman Seidelsohn Date: Sat, 8 Apr 2023 23:17:11 +0200 Subject: [PATCH] refactor: Provide a better name for the files variable The files variable stores the names of files in the current module's directory that have been recognized as possible license files --- lib/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/index.js b/lib/index.js index 9f954ea..1d4d726 100644 --- a/lib/index.js +++ b/lib/index.js @@ -45,7 +45,7 @@ const flatten = function flatten(options) { const moduleInfo = { licenses: UNKNOWN }; const { color: colorize, deps: json, unknown } = options; const currentPackageNameAndVersion = `${json.name}@${json.version}`; - let files = []; + let licenseFilesInCurrentModuleDirectory = []; let licenseData; let licenseFile; let noticeFiles = []; @@ -171,10 +171,10 @@ const flatten = function flatten(options) { /*istanbul ignore else*/ if (clarification?.licenseFile) { - files = [clarification.licenseFile]; + licenseFilesInCurrentModuleDirectory = [clarification.licenseFile]; } else if (fs.existsSync(module_path)) { - files = licenseFiles(dirFiles); const filesInModuleDirectory = fs.readdirSync(module_path); + licenseFilesInCurrentModuleDirectory = licenseFiles(filesInModuleDirectory); noticeFiles = filesInModuleDirectory.filter((filename) => { filename = filename.toUpperCase(); @@ -184,7 +184,7 @@ const flatten = function flatten(options) { }); } - files.forEach(function (filename, index) { + licenseFilesInCurrentModuleDirectory.forEach(function (filename, index) { licenseFile = path.join(module_path, filename); // Checking that the file is in fact a normal file and not a directory for example. /*istanbul ignore else*/