MCPcopy Create free account
hub / github.com/Effect-TS/effect / appendPublicSeeDiagnostics

Function appendPublicSeeDiagnostics

packages/tools/jsdocs/src/Jsdocs.ts:2355–2381  ·  view source on GitHub ↗
(
  files: ReadonlyArray<JSDocModelFile>,
  apis: ReadonlyArray<JSDocApi>
)

Source from the content-addressed store, hash-verified

2353}
2354
2355function appendPublicSeeDiagnostics(
2356 files: ReadonlyArray<JSDocModelFile>,
2357 apis: ReadonlyArray<JSDocApi>
2358): { readonly files: ReadonlyArray<JSDocModelFile>; readonly added: boolean } {
2359 const diagnosticsByFile = new Map(files.map((file) => [file.file, [...file.diagnostics]]))
2360 let added = false
2361 for (const api of apis) {
2362 const diagnostics = diagnosticsByFile.get(api.source.file)
2363 if (diagnostics === undefined) continue
2364 for (const tag of api.see) {
2365 for (const link of tag.links) {
2366 const item = unresolvedPublicSeeDiagnostic(link)
2367 if (item === undefined || diagnostics.some((diagnostic) => sameDiagnostic(diagnostic, item))) continue
2368 diagnostics.push(item)
2369 added = true
2370 }
2371 }
2372 }
2373 if (!added) return { files, added }
2374 return {
2375 added,
2376 files: files.map((file) => ({
2377 ...file,
2378 diagnostics: diagnosticsByFile.get(file.file) ?? file.diagnostics
2379 }))
2380 }
2381}
2382
2383function moduleSeeTags(
2384 file: JSDocModelFile,

Calls 6

sameDiagnosticFunction · 0.85
someMethod · 0.80
pushMethod · 0.80
getMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected