Skip to content

Conversation

@amanfcp
Copy link
Contributor

@amanfcp amanfcp commented Dec 4, 2025

Description:

Add support for glob patterns in the repositories field, allowing flexible repository matching alongside explicit URLs. Refactors repository resolution logic into resolveRepositories() to eliminate duplication between Chunks() and Enumerate(), improving maintainability and consistency.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@amanfcp amanfcp requested a review from a team December 4, 2025 08:15
@amanfcp amanfcp requested a review from a team as a code owner December 4, 2025 08:15
Comment on lines +1031 to +1038
// resolveRepositories determines which repositories to scan based on s.repos configuration.
// It handles three cases:
// 1. Glob patterns (e.g., "org/*"): enumerates all projects and filters using patterns
// 2. Explicit URLs: normalizes and reports directly without enumeration
// 3. Empty: enumerates all projects using includeRepos/ignoreRepos filters
//
// All discovered repositories are reported via reporter.UnitOk().
func (s *Source) resolveRepositories(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the implementation for includeRepos, it looks pretty straightforward where we directly pass in the s.includeRepos slice to buildIgnorer. Why can't we do the same with repos? Why do we need to handle all these cases separately? Is there any context I'm missing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question! Here's what I've understood since working on this:

includeRepos:

  • Always a filter on enumerated projects
  • Assumes you're scanning "everything with filters"
  • Always calls listProjects() then filters results

repos:

  • Can be explicit URLs OR glob patterns
  • Supports 3 distinct modes:
    a. Explicit URLs only - Use directly, no enumeration needed
    b. Glob patterns - Enumerate projects and filter
    c. Mixed - Enumerate for globs, use explicit URLs directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants