sendLints
Send the lint findings of a branch's definitions the remote doesn't have, under the keys they were kept under (the linter's version and configuration): a definition's findings depend only on those and its code, so they hold wherever it's linted the same. How many were sent (none to a remote that doesn't keep them).
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { chunks, lintedIn } from "#codebase/tcmts/cli/sync"; import type { Remote, SharedLint } from "#codebase/tcmts/cli/sync"; import type { NameRow } from "#codebase/tcmts/store"; export async function sendLints(cb: Codebase, remote: Remote, names: NameRow[]): Promise<number> { const defs = lintedIn(names); try { const theirs = new Set<string>(); for (const c of chunks(defs)) for (const [h, k] of (await remote.lintKeys(c)) ?? []) theirs.add(`${h} ${k}`); const missing: SharedLint[] = []; for (const h of defs) for (const key of cb.store.lintKeysOf(h)) if (!theirs.has(`${h} ${key}`)) missing.push({ hash: h, key, issues: cb.store.lintResult(h, key)! }); for (const c of chunks(missing, 500)) await remote.putLints(c); return missing.length; } catch { return 0; } }
uses
- tcmts.cli.codebase.Codebase
- tcmts.cli.sync.Remote
- tcmts.cli.sync.SharedLint
- tcmts.cli.sync.chunks
- tcmts.cli.sync.lintedIn
- tcmts.store.NameRow