in eng/tools/lint-diff/src/processChanges.ts [14:60]
export async function getRunList(
beforePath: string,
afterPath: string,
changedFilesPath: string,
): Promise<[Map<string, string[]>, Map<string, string[]>, Set<string>]> {
// Forward slashes are OK list coming from changedFilesPath is from git which
// always uses forward slashes as path separators
// Read changed files, exclude any files that should be ignored
const ignoreFilesWith = ["/examples/", "/quickstart-templates/", "/scenarios/"];
const changedSpecFiles = (await readFileList(changedFilesPath)).filter((file) => {
// File is in specification/ folder
if (!specification(file)) {
return false;
}
// File is not ignored
for (const ignore of ignoreFilesWith) {
if (file.includes(ignore)) {
return false;
}
}
return true;
});
// In the future, the loop involving [beforePath, afterPath] can be eliminated
// as well as beforeState
const [beforeState, _] = await buildState(changedSpecFiles, beforePath);
const [afterState, afterSwaggers] = await buildState(changedSpecFiles, afterPath);
const affectedSwaggers = new Set<string>(afterSwaggers);
const [beforeTagMap, afterTagMap] = reconcileChangedFilesAndTags(beforeState, afterState);
console.log("Before readme and tags:");
console.table([...beforeTagMap].map(([readme, tags]) => ({ readme, tags })), ['readme', 'tags']);
console.log("\n");
console.log("After readme and tags:");
console.table([...afterTagMap].map(([readme, tags]) => ({ readme, tags })), ['readme', 'tags']);
console.log("\n");
console.log("Affected swaggers:");
console.table([...affectedSwaggers].map((swagger) => ({ swagger })), ['swagger']);
console.log("\n");
return [beforeTagMap, afterTagMap, affectedSwaggers];
}