Skip to content

Commit

Permalink
refactor(vcs): Shorten names
Browse files Browse the repository at this point in the history
  • Loading branch information
elldritch committed Aug 7, 2018
1 parent e3e1a93 commit ab5c1cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion analyzers/golang/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (a *Analyzer) Project(pkg string) (Project, error) {
tool, manifestDir, err := NearestLockfile(dir)

// Find the nearest VCS repository.
_, repoRoot, err := vcs.NearestVCS(dir)
_, repoRoot, err := vcs.Nearest(dir)
if err != nil {
return Project{}, err
}
Expand Down
12 changes: 6 additions & 6 deletions vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ var (
ErrNoNearestVCS = errors.New("could not find nearest VCS repository in directory")
)

// VCSIn returns the type of VCS repository rooted at a directory, or
// In returns the type of VCS repository rooted at a directory, or
// ErrNoVCSInDir if none is found.
func vcsIn(dirname string) (VCS, error) {
func In(dirname string) (VCS, error) {
for _, vcs := range Types {
ok, err := files.ExistsFolder(filepath.Join(dirname, MetadataFolder(vcs)))
if err != nil {
Expand All @@ -31,12 +31,12 @@ func vcsIn(dirname string) (VCS, error) {
return 0, ErrNoVCSInDir
}

// NearestVCS returns the type and directory of the nearest VCS repository
// Nearest returns the type and directory of the nearest VCS repository
// containing the directory, or ErrNoNearestVCS if none is found.
func NearestVCS(dirname string) (VCS, string, error) {
func Nearest(dirname string) (VCS, string, error) {
var vcs VCS
dir, err := files.WalkUp(dirname, func(d string) error {
tool, err := vcsIn(d)
tool, err := In(d)
if err == ErrNoVCSInDir {
return nil
}
Expand All @@ -56,7 +56,7 @@ func NearestVCS(dirname string) (VCS, string, error) {
// errutil.ErrRepositoryNotFound if none is found, or errutil.ErrNotImplemented
// if an unsupported VCS is found.
func GetRepository(dirname string) (string, error) {
vcs, dir, err := NearestVCS(dirname)
vcs, dir, err := Nearest(dirname)
if err == ErrNoNearestVCS {
return "", errutil.ErrRepositoryNotFound
}
Expand Down

0 comments on commit ab5c1cd

Please sign in to comment.