feat: add Bitbucket workspace support for PR complexity analysis#4
Merged
OhadPerryBoomi merged 3 commits intomainfrom Mar 11, 2026
Merged
feat: add Bitbucket workspace support for PR complexity analysis#4OhadPerryBoomi merged 3 commits intomainfrom
OhadPerryBoomi merged 3 commits intomainfrom
Conversation
Scan and tag Bitbucket PRs alongside GitHub. Adds cli/bitbucket.py API client (diff, metadata, project repo discovery, merged PR search, complexity comments). Extends parse_pr_url and CSV schema with a `source` column (auto-detected, backward-compatible). Updates sync-new-prs.sh with a second Bitbucket pass (BB_PROJECT env var). Includes 12 initial Bitbucket PR scores in complexity-report.csv. Made-with: Cursor
Run black on all changed files to pass CI format check. Update test_invalid_pr_url assertions to accept the new "Unrecognized PR URL" message from multi-provider URL parsing. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened using this rule: https://github.com/RiveryIO/rivery-cursor-rules/blob/main/administrative/github-pr.md
Description
Adds full Bitbucket workspace support so the complexity analyzer can scan and tag PRs from both GitHub and Bitbucket in a single pipeline.
What changed
cli/bitbucket.py— Bitbucket API client: fetch PR diffs, metadata, discover project repos, search merged PRs, post complexity comments (with<!-- [complexity-analyzer] -->marker for idempotency).cli/utils.py—parse_pr_url()now accepts both GitHub and Bitbucket URLs (same 3-tuple return — backward-compatible). Addeddetect_pr_provider().cli/csv_handler.py— Addedsourcecolumn (auto-detected from URL, appended at end so existing data is unaffected).pandas.read_csv()in reports handles missing column gracefully.cli/main.py—analyze_pr_to_dict()and dry-run path route to GH or BB fetch based on URL. New--bb-projectoption onbatch-analyze.cli/batch.py—generate_pr_list_from_bb_project()discovers repos by project UUID, collects merged PRs. Label check/apply routes to BB comments for Bitbucket URLs. Source-filtered incremental fetch (get_max_merged_for_source).cli/analyze.py— Bothanalyze_single_pr()andhandle_dry_run()route by provider.cli/config.py—get_bitbucket_credentials()readsBITBUCKET_EMAIL+BITBUCKET_API_TOKEN.cli/migrate.py— Backfillssourcecolumn from URL; skips GitHub API enrichment for BB rows.scripts/sync-new-prs.sh— Two-pass daily sync: Pass 1 (GitHub via--repos-file), Pass 2 (Bitbucket via--bb-project). SupportsSKIP_GH=1/SKIP_BB=1env vars.complexity-report.csv— Rewritten withsourcecolumn, sorted by date. Includes 12 initial Bitbucket PR scores.detect_pr_provider(), BB source auto-detection in CSV writer, updated verify test fixture.Backward compatibility
parse_pr_url()return type unchanged (3-tuple) — zero caller changes needed.sourcecolumn added at end of CSV schema — existingpd.read_csv()consumers unaffected.migrate-csvon old CSVs backfillssourceas"github"automatically.Testing
test_utils,test_csv_handler,test_verify)sourcecolumn, reports generate without errorsUsage