darnit audit silently resolves upstream and never prints the audited repo

未关闭 适合新手
#344 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cli, github, python

调研方向

从 packages/darnit/src/darnit/core/utils.py 开始,重点查看 detect_repo_from_git 和 detect_owner_repo,然后找到 cmd_audit 及其当前的审计日志。解析仓库时保留检测到的远程来源,并在审计输出中包含解析后的 owner/repo 和来源。运行相关的审计 CLI 测试;完成的标准是用户能够看到审计了哪个仓库和远程源。

由索引模型根据 Issue 内容生成。

描述

module-baseline

Description

darnit audit <path> auto-detects owner/repo preferring the upstream remote, and never prints which owner/repo it resolved. On a fork checkout (both origin and upstream present), the live checks target upstream — potentially a different repo than the one the user is working in — with no indication in the output.

Steps to Reproduce

  1. Clone a fork so the checkout has both origin (your fork) and upstream remotes.
  2. Run darnit audit <path> with authenticated gh.
  3. Inspect which owner/repo the live gh api checks target.

Expected Behavior

The audit output states the resolved owner/repo and which remote it came from, so it's obvious which repository was audited.

Actual Behavior

The checks target upstream silently; the CLI logs only Auditing {path} with {N} controls. Details:

  • packages/darnit/src/darnit/core/utils.py:186, :302 — prefer_upstream: bool = True.
  • utils.py:231 — remotes = ["upstream", "origin"] if prefer_upstream else ["origin", "upstream"].
  • cmd_audit calls detect_owner_repo(str(repo_path)) with no override and prints no repo identity.

The information already exists internally: detect_repo_from_git returns a source field (utils.py:263, 275), but the detect_owner_repo wrapper (:299) collapses it to (owner, repo) and the CLI discards it.

Environment

  • darnit version: main @ 86f9cfa
  • Python version: 3.12 (uv-managed)
  • OS: any

Additional Context

Suggested fix (visibility only): print the resolved owner/repo + source remote at the top of audit output. A new --owner/--repo flag is likely unnecessary — the origin-preference path (prefer_upstream=False) already resolves origin correctly.

主要语言
Python
星标
22
派生
27
平均合并
4 天 20 小时
30 天内合并 PR
75

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

darnitdevorg/darnit 的其他 Issue

查看 darnitdevorg/darnit 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。