Documentation
¶
Overview ¶
internal/analyzer/analyzer.go
internal/analyzer/clone.go
Index ¶
- func Checkout(repo *git.Repository, dir string, hash plumbing.Hash) error
- type Analyzer
- type Cloner
- func (c *Cloner) Clone(ctx context.Context, cloneURL string) (dir string, cleanup func(), err error)
- func (c *Cloner) CloneFull(ctx context.Context, cloneURL string) (repo *git.Repository, dir string, cleanup func(), err error)
- func (c *Cloner) CloneTo(ctx context.Context, cloneURL, destDir string) (string, func(), error)
- func (c *Cloner) Download(ctx context.Context, downloadURL string) (dir string, cleanup func(), err error)
- func (c *Cloner) DownloadTo(ctx context.Context, downloadURL, destDir string) (string, func(), error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Analyzer ¶
type Analyzer struct{}
Analyzer wraps scc's processor package to analyze source code directories.
type Cloner ¶
type Cloner struct {
// contains filtered or unexported fields
}
Cloner performs shallow git clones into temporary directories.
func NewCloner ¶
NewCloner creates a Cloner. If token is non-empty it will be used for HTTP basic-auth. If username is empty, "x-token-auth" is used (works for OAuth tokens on GitHub and Bitbucket). For Bitbucket API tokens, pass the Atlassian email as username.
func (*Cloner) Clone ¶
func (c *Cloner) Clone(ctx context.Context, cloneURL string) (dir string, cleanup func(), err error)
Clone shallow-clones the repository at cloneURL into a temporary directory. It returns the directory path, a cleanup function that removes the directory, and any error. The caller must call cleanup when done with the directory.
func (*Cloner) CloneFull ¶ added in v0.5.0
func (c *Cloner) CloneFull(ctx context.Context, cloneURL string) (repo *git.Repository, dir string, cleanup func(), err error)
CloneFull clones the repository at cloneURL with full history into a temporary directory. It returns the go-git Repository handle, the directory path, a cleanup function, and any error.
func (*Cloner) CloneTo ¶ added in v0.9.0
CloneTo shallow-clones the repository at cloneURL into destDir. If destDir already exists and contains entries the clone is skipped. The returned cleanup function is always a no-op because the directory is meant to be durable (persist across runs).
func (*Cloner) Download ¶ added in v0.3.0
func (c *Cloner) Download(ctx context.Context, downloadURL string) (dir string, cleanup func(), err error)
Download fetches a tarball from downloadURL, extracts it to a temporary directory, and returns the path. This is used when git clone is not available (e.g. Bitbucket scoped API tokens).
func (*Cloner) DownloadTo ¶ added in v0.9.0
func (c *Cloner) DownloadTo(ctx context.Context, downloadURL, destDir string) (string, func(), error)
DownloadTo fetches a tarball from downloadURL and extracts it to destDir. If destDir already exists and contains entries the download is skipped. The returned cleanup function is always a no-op because the directory is meant to be durable (persist across runs).