mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-28 22:39:05 +08:00
Merge pull request #204 from tariq1890/master
Renaming repos directory to _repos as per issue #203 and updating travis yml
This commit is contained in:
@@ -2,6 +2,7 @@ language: go
|
||||
|
||||
go:
|
||||
- 1.8
|
||||
- 1.9
|
||||
- tip
|
||||
|
||||
install:
|
||||
|
||||
@@ -216,7 +216,7 @@ func goPkgInToGitHub(name string) string {
|
||||
|
||||
func fileURL(dir, filename string) string {
|
||||
var fileURL string
|
||||
base := strings.TrimPrefix(dir, "repos/src/")
|
||||
base := strings.TrimPrefix(dir, "_repos/src/")
|
||||
switch {
|
||||
case strings.HasPrefix(base, "golang.org/x/"):
|
||||
var pkg string
|
||||
@@ -263,14 +263,14 @@ func getFileSummaryMap(out *bufio.Scanner, dir string) (map[string]FileSummary,
|
||||
outer:
|
||||
for out.Scan() {
|
||||
filename := strings.Split(out.Text(), ":")[0]
|
||||
filename = strings.TrimPrefix(filename, "repos/src")
|
||||
filename = strings.TrimPrefix(filename, "_repos/src")
|
||||
for _, skip := range skipSuffixes {
|
||||
if strings.HasSuffix(filename, skip) {
|
||||
continue outer
|
||||
}
|
||||
}
|
||||
|
||||
if autoGenerated("repos/src" + filename) {
|
||||
if autoGenerated("_repos/src" + filename) {
|
||||
continue outer
|
||||
}
|
||||
|
||||
@@ -391,10 +391,10 @@ func GoFmtNative(dir string, filenames []string) (float64, []FileSummary, error)
|
||||
errChan <- err
|
||||
}
|
||||
if !bytes.Equal(b, g) {
|
||||
filename := strings.TrimPrefix(f, "repos/src")
|
||||
filename := strings.TrimPrefix(f, "_repos/src")
|
||||
fs := FileSummary{}
|
||||
fs.Filename = makeFilename(filename)
|
||||
fu := fileURL(dir, strings.TrimPrefix(f, "repos/src"))
|
||||
fu := fileURL(dir, strings.TrimPrefix(f, "_repos/src"))
|
||||
fs.FileURL = fu
|
||||
fs.Errors = append(fs.Errors, Error{1, "file is not gofmted"})
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func dirName(repo string) string {
|
||||
return fmt.Sprintf("repos/src/%s", repo)
|
||||
return fmt.Sprintf("_repos/src/%s", repo)
|
||||
}
|
||||
|
||||
func getFromCache(repo string) (checksResp, error) {
|
||||
@@ -87,7 +87,7 @@ func newChecksResp(repo string, forceRefresh bool) (checksResp, error) {
|
||||
}
|
||||
|
||||
// fetch the repo and grade it
|
||||
repoRoot, err := download.Download(repo, "repos/src")
|
||||
repoRoot, err := download.Download(repo, "_repos/src")
|
||||
if err != nil {
|
||||
return checksResp{}, fmt.Errorf("could not clone repo: %v", err)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ var dirNameTests = []struct {
|
||||
url string
|
||||
want string
|
||||
}{
|
||||
{"github.com/foo/bar", "repos/src/github.com/foo/bar"},
|
||||
{"github.com/foo/bar", "_repos/src/github.com/foo/bar"},
|
||||
}
|
||||
|
||||
func TestDirName(t *testing.T) {
|
||||
|
||||
2
main.go
2
main.go
@@ -78,7 +78,7 @@ func initDB() error {
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if err := os.MkdirAll("repos/src/github.com", 0755); err != nil && !os.IsExist(err) {
|
||||
if err := os.MkdirAll("_repos/src/github.com", 0755); err != nil && !os.IsExist(err) {
|
||||
log.Fatal("ERROR: could not create repos dir: ", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user