kunibert
All repositories: gitoria
2.4 KB
$mode = 'static'import { run } from 'hl:proc'import { require } from './review-output.hl'// Read the optional ignore file from the exact PR HEAD, also before a worktree exists.vendoredPaths = (String repo, String head, Hybrid configured) => {prefixes = []for (p of configured) { if (p != '' && !prefixes.includes(p)) { prefixes.push(p) } }names = run(['git', 'ls-tree', '--name-only', head, '--', '.kunibertignore'], { cwd = repo, timeout = 30 })require(names.exit == 0, 'cannot look up .kunibertignore at PR head')if (!names.lines.includes('.kunibertignore')) { return prefixes }file = run(['git', 'show', head + ':.kunibertignore'], { cwd = repo, timeout = 30 })require(file.exit == 0, 'cannot read .kunibertignore at PR head')for (line of file.lines) {p = line.trim()if (p != '' && !p.startsWith('#') && !prefixes.includes(p)) { prefixes.push(p) }}return prefixes}isVendored = (String path, Hybrid prefixes) => {for (p of prefixes) { if (path.startsWith(p)) { return true } }return false}// Keep old keys stable, but settle these threads before thread updates and wake prompts.settleVendored = (Hybrid state, Hybrid prefixes) => {for (let i = 0; i < state.threads.length; i = i + 1) {t = state.threads[i]if (isVendored(t.path, prefixes)) {t.vendored = truet.settled = trueif (!state.settled.includes(t.key)) { state.settled.push(t.key) }state.threads[i] = t}}return state}// Only app findings enter applyResult: framework findings never get a thread key.appResult = (Hybrid result, Hybrid prefixes, Hybrid state, String link) => {app = []framework = []for (f of result.findings) {if (isVendored(f.path, prefixes)) { framework.push(f) } else { app.push(f) }}replies = []for (r of result.replies) {let vendored = falsefor (t of state.threads) { if (t.key == r.thread && t.vendored) { vendored = true } }if (!vendored) { replies.push(r) }}result.findings = appresult.framework = frameworkresult.replies = repliesresult.vendoredLink = linkif (prefixes.length > 0) {result.verdict = app.length == 0 ? 'approve' : 'comment'for (f of app) { if (f.severity == 'blocker' || f.severity == 'major') { result.verdict = 'request_changes' } }}return result}
Branches
Latest commits
- 1aa4d64crecords: HL-STANDARD L10 update livemre
- 2b04c240Merge branch 'hl-standard-l10' into mainKunibert
- 88c7b09d|||PR HL-STANDARD L10 update (hybriel 5885d688), rules version 3mre
- 00869ecbrecords: gitoria#50 step 3 livemre
- f97a0e5fMerge branch 'hl-standard' into mainKunibert
- 9710e39fType STANDARD as String (L10, Kunibert review)mre
- 4140b664|||PR Review against HL-STANDARD and cite rule ids (gitoria#50 step 3)mre
- 75c6888drecords: gitoria#50 step 1 connected and provenmre
- aa6d997frecords: gitoria#50 connect plan, Anton reportmre
- 8a190ba7Records: kunibert#18 and #15 donemre
- 2eee9dbbMerge branch 'revendor-day44' into mainKunibert
- e96721cb|||PR Re-vendor plugins from Hybriel day44 (hl:fetch redirect fix)mre
- 0c67ab8cLog: kunibert repo ping provenmre
- b6f3039cLog: kunibert repo connectedmre
- b143c3c7CONDUCTOR: push recipemre
- 7a1279eeRule: conductor merges own utility PRs after green reviewmre
- 4038b3e0Log: kunibert#18 openedmre
- 18543db1Log: day42 fetch fix, re-vendor pendingmre
- 81a12f96Statusmre
- 6ce706abRecords: neutral wording, split cleanupmre