gitoria

kunibert

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit10b2a49e10b2a49estatus: PR 314, guard fix proposedmre10b2a49e/lib/review-vendored.hl

2.4 KB

  1. $mode = 'static'
  2. import { run } from 'hl:proc'
  3. import { require } from './review-output.hl'
  4. // Read the optional ignore file from the exact PR HEAD, also before a worktree exists.
  5. vendoredPaths = (String repo, String head, Hybrid configured) => {
  6. prefixes = []
  7. for (p of configured) { if (p != '' && !prefixes.includes(p)) { prefixes.push(p) } }
  8. names = run(['git', 'ls-tree', '--name-only', head, '--', '.kunibertignore'], { cwd = repo, timeout = 30 })
  9. require(names.exit == 0, 'cannot look up .kunibertignore at PR head')
  10. if (!names.lines.includes('.kunibertignore')) { return prefixes }
  11. file = run(['git', 'show', head + ':.kunibertignore'], { cwd = repo, timeout = 30 })
  12. require(file.exit == 0, 'cannot read .kunibertignore at PR head')
  13. for (line of file.lines) {
  14. p = line.trim()
  15. if (p != '' && !p.startsWith('#') && !prefixes.includes(p)) { prefixes.push(p) }
  16. }
  17. return prefixes
  18. }
  19. isVendored = (String path, Hybrid prefixes) => {
  20. for (p of prefixes) { if (path.startsWith(p)) { return true } }
  21. return false
  22. }
  23. // Keep old keys stable, but settle these threads before thread updates and wake prompts.
  24. settleVendored = (Hybrid state, Hybrid prefixes) => {
  25. for (let i = 0; i < state.threads.length; i = i + 1) {
  26. t = state.threads[i]
  27. if (isVendored(t.path, prefixes)) {
  28. t.vendored = true
  29. t.settled = true
  30. if (!state.settled.includes(t.key)) { state.settled.push(t.key) }
  31. state.threads[i] = t
  32. }
  33. }
  34. return state
  35. }
  36. // Only app findings enter applyResult: framework findings never get a thread key.
  37. appResult = (Hybrid result, Hybrid prefixes, Hybrid state, String link) => {
  38. app = []
  39. framework = []
  40. for (f of result.findings) {
  41. if (isVendored(f.path, prefixes)) { framework.push(f) } else { app.push(f) }
  42. }
  43. replies = []
  44. for (r of result.replies) {
  45. let vendored = false
  46. for (t of state.threads) { if (t.key == r.thread && t.vendored) { vendored = true } }
  47. if (!vendored) { replies.push(r) }
  48. }
  49. result.findings = app
  50. result.framework = framework
  51. result.replies = replies
  52. result.vendoredLink = link
  53. if (prefixes.length > 0) {
  54. result.verdict = app.length == 0 ? 'approve' : 'comment'
  55. for (f of app) { if (f.severity == 'blocker' || f.severity == 'major') { result.verdict = 'request_changes' } }
  56. }
  57. return result
  58. }

Branches

Latest commits

  • 10b2a49estatus: PR 314, guard fix proposedmre
  • e73995a3log: hycon PR 314 approved after fresh reviewmre
  • f60427falog: hycon PR 314 false tool errormre
  • 481974f7log: Hermes accepts PR 259 findingmre
  • bb0976acrecords: hycon PR 259 design findingmre
  • 5c637c24records: hycon PR 259 false tool errormre
  • a344c406log: routger 132 reviewedmre
  • 56e70dcbrecords: review time limit 1800 s (routger 132)mre
  • c3a304c5Merge branch 'job-timeout' into mainKunibert
  • 402bfeb0|||PR runner: the model run uses the job's time limit (jobTimeoutSeconds), not a fixed 900 smre
  • 8d34ca33records: repo rename (gitoria#53)mre
  • 1e05cb3fMerge branch 'repo-rename' into mainKunibert
  • 6ee0d2e9|||PR intake: match a delivery by repo.id and signature, not URLs (gitoria#53 rename)mre
  • 900ffcd4status: routgermre
  • 59b0b793log: routger merge waitmre
  • e52f094alog: routger intake check (hycon#122)mre
  • f979027frecords: design rule livemre
  • 71efaf84Merge branch 'design-guard' into mainKunibert
  • c0656581|||PR Flag removal of a documented design as major unless his recorded yes is linked; rules version 5mre
  • 901cdd75records: L10 update 2 livemre