github.com/jfrog/frogbot@v1.1.1-0.20231221090046-821a26f50338/scanrepository/scanmultiplerepositories.go (about)

     1  package scanrepository
     2  
     3  import (
     4  	"errors"
     5  	"github.com/jfrog/frogbot/utils"
     6  	"github.com/jfrog/froggit-go/vcsclient"
     7  )
     8  
     9  type ScanMultipleRepositories struct {
    10  	// dryRun is used for testing purposes, mocking part of the git commands that requires networking
    11  	dryRun bool
    12  	// When dryRun is enabled, dryRunRepoPath specifies the repository local path to clone
    13  	dryRunRepoPath string
    14  }
    15  
    16  func (saf *ScanMultipleRepositories) Run(repoAggregator utils.RepoAggregator, client vcsclient.VcsClient, frogbotRepoConnection *utils.UrlAccessChecker) (err error) {
    17  	scanRepositoryCmd := &ScanRepositoryCmd{dryRun: saf.dryRun, dryRunRepoPath: saf.dryRunRepoPath, baseWd: saf.dryRunRepoPath}
    18  	for repoNum := range repoAggregator {
    19  		repoAggregator[repoNum].OutputWriter.SetHasInternetConnection(frogbotRepoConnection.IsConnected())
    20  		if e := scanRepositoryCmd.scanAndFixRepository(&repoAggregator[repoNum], client); e != nil {
    21  			err = errors.Join(err, e)
    22  		}
    23  	}
    24  	return
    25  }