Skip to content

Conversation

@alexander-turner
Copy link

Summary

deepsource issues list currently only shows issues from the repository's default branch. This PR adds a --commit flag that queries issues from the analysis run for a specific commit SHA, enabling users to see issues found on PR branches and non-default branches.

Motivation: When using DeepSource in CI pipelines or local pre-push hooks, it's useful to check what issues a specific commit introduced — particularly on feature branches where DeepSource already runs analysis via the GitHub App. Today the only way to see branch-specific results is through the web dashboard; this change brings that capability to the CLI.

NOTE: This PR is AI-written but seems to work. I don't know Go, otherwise I'd scrutinize myself. Please LMK if changes need to be made.

Usage

# List issues found in the analysis run for a specific commit
deepsource issues list --commit abc123def456

# Combine with existing flags
deepsource issues list --commit abc123 --analyzer python --limit 50
deepsource issues list --commit abc123 --json --output-file results.json

Changes

New file: deepsource/issues/queries/list_run_issues.go

  • GraphQL query using run(commitOid:)checksoccurrences to fetch issues from a specific analysis run
  • Response types and Do() method following the existing patterns in list_issues.go and list_file_issues.go
  • Total result count capped to the requested --limit (the GraphQL limit applies per-analyzer check, so without the cap, 3 analyzers × 100 limit = 300 results)

Modified: deepsource/client.go

  • New GetIssuesByCommit(ctx, commitOID, limit) SDK method, mirroring the existing GetIssues and GetIssuesForFile

Modified: command/issues/list/list.go

  • --commit flag (long form only — no shorthand to avoid -c conflicts with common --config conventions)
  • Commit SHA validation (must be 6-40 hex characters)
  • Mutual exclusion with --repo (commit lookup is repo-agnostic via the API)
  • Skips ResolveRemote when --commit is specified (no git context needed)
  • Existing --analyzer, --limit, --json/--csv/--sarif, and --output-file flags all work with --commit

Testing

  • go build ./... passes
  • go test ./command/issues/list/ passes (existing tests unaffected)
  • Manually verified the run(commitOid:) GraphQL endpoint returns correct data via the DeepSource Cloud API (api.deepsource.io/graphql/)

Notes

  • The GraphQL query uses the run(commitOid:) root query field and traverses checks.occurrences to collect issues. This field is documented in the DeepSource API but was not previously exposed by the CLI.
  • All output formats (table, JSON, CSV, SARIF) work with the new flag since the issues are normalized into the same []issues.Issue slice used by the default code path.

Add support for listing issues from an analysis run for a specific
commit SHA. This enables querying issues on PR branches and non-default
branches via the run(commitOid:) GraphQL endpoint.

Usage:
  deepsource issues list --commit <SHA>
alexander-turner pushed a commit to alexander-turner/cli that referenced this pull request Feb 9, 2026
…tion

- Move regexp.MustCompile to package-level var to avoid recompilation
  on every invocation (idiomatic Go)
- Use cobra's MarkFlagsMutuallyExclusive for --commit/--repo instead
  of manual check in Run(), providing better UX and cleaner code
- Fix misleading doc comment: "full commit SHA" -> describes that
  abbreviated SHAs (6-40 hex chars) are accepted
- Add empty occurrences guard in list_run_issues.go to match the
  established pattern in list_issues.go and list_file_issues.go

Closes DeepSourceCorp#261

https://claude.ai/code/session_01UrmgEwEjAJZzyE2tbVyJHw
alexander-turner added a commit to alexander-turner/cli that referenced this pull request Feb 9, 2026
- Move regexp.MustCompile to package-level var (idiomatic Go)
- Use cobra MarkFlagsMutuallyExclusive for --commit/--repo
- Fix misleading "full commit SHA" doc comment
- Add empty occurrences guard matching existing query patterns
- Document --commit flag in README (resolves DeepSourceCorp#261)
…WEbLE

fix: address code review issues in --commit flag (PR DeepSourceCorp#267)
alexander-turner pushed a commit to alexander-turner/TurnTrout.com that referenced this pull request Feb 10, 2026
Update session-setup.sh to build the DeepSource CLI from the fork at
alexander-turner/cli (branch feat/issues-list-by-commit) which adds
`--commit` flag to `deepsource issues list`. This allows querying
issues for a specific commit SHA instead of only the default branch.

Falls back to the official CLI installer when Go is not available.

Add a DeepSource issues check step to the PR creation skill that runs
`deepsource issues list --commit <SHA>` after CI checks pass, with
retry logic for when analysis isn't ready yet.

Source: DeepSourceCorp/cli#267

https://claude.ai/code/session_01ANbcgw6Gt1895P6hpJMgVL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants