in src/controller/lintController.ts [90:133]
async lintWorkspace() {
const workspace = vscode.workspace.workspaceFolders?.at(0);
if (!workspace) {
return;
}
const { versionPath, guid, version } =
await this.directoryController.splitUri(workspace.uri);
if (!versionPath) {
return;
}
if (await this.addonCacheController.isVersionDirty(guid, version)) {
return;
}
const { success, messages } = (await this.fetchLints(guid, version)) || [
undefined,
undefined,
];
if (!success) {
return;
}
const populateDiagnostic = async (messages: Message[]) => {
for (const message of messages) {
const diagnostic = await this.formatNotice(versionPath, message);
if (diagnosticMap.has(message.file)) {
diagnosticMap.get(message.file)?.push(diagnostic);
} else {
diagnosticMap.set(message.file, [diagnostic]);
}
}
};
const diagnosticMap: Map<string, vscode.Diagnostic[]> = new Map();
await populateDiagnostic(messages);
diagnosticMap.forEach((diagnostics, file) => {
const uri = this.getUriFromVersionPath(versionPath, file);
this.diagnosticCollection.set(uri, diagnostics);
});
}