Prechádzať zdrojové kódy

Rename stdout -> yaml

Vadim Markovtsev 7 rokov pred
rodič
commit
6530890fcd
4 zmenil súbory, kde vykonal 13 pridanie a 13 odobranie
  1. 1 1
      Makefile
  2. 6 6
      burndown.go
  3. 5 5
      couples.go
  4. 1 1
      stdout/utils.go

+ 1 - 1
Makefile

@@ -20,7 +20,7 @@ ${GOPATH}/src/gopkg.in/bblfsh/client-go.v2:
 	make dependencies
 
 .ONESHELL:
-${GOPATH}/bin/hercules: *.go cmd/hercules/*.go rbtree/*.go stdout/*.go toposort/*.go pb/*.go
+${GOPATH}/bin/hercules: *.go cmd/hercules/*.go rbtree/*.go yaml/*.go toposort/*.go pb/*.go
 	cd ${GOPATH}/src/gopkg.in/src-d/hercules.v3
 	go get -ldflags "-X gopkg.in/src-d/hercules.v3.GIT_HASH=$$(git rev-parse HEAD)" gopkg.in/src-d/hercules.v3/cmd/hercules
 

+ 6 - 6
burndown.go

@@ -15,7 +15,7 @@ import (
 	"gopkg.in/src-d/go-git.v4/plumbing/object"
 	"gopkg.in/src-d/go-git.v4/utils/merkletrie"
 	"gopkg.in/src-d/hercules.v3/pb"
-	"gopkg.in/src-d/hercules.v3/stdout"
+	"gopkg.in/src-d/hercules.v3/yaml"
 )
 
 // BurndownAnalyser allows to gather the line burndown statistics for a Git repository.
@@ -262,26 +262,26 @@ func (analyser *BurndownAnalysis) Serialize(result interface{}, binary bool, wri
 func (analyser *BurndownAnalysis) serializeText(result *BurndownResult, writer io.Writer) {
 	fmt.Fprintln(writer, "  granularity:", analyser.Granularity)
 	fmt.Fprintln(writer, "  sampling:", analyser.Sampling)
-	stdout.PrintMatrix(writer, result.GlobalHistory, 2, "project", true)
+	yaml.PrintMatrix(writer, result.GlobalHistory, 2, "project", true)
 	if len(result.FileHistories) > 0 {
 		fmt.Fprintln(writer, "  files:")
 		keys := sortedKeys(result.FileHistories)
 		for _, key := range keys {
-			stdout.PrintMatrix(writer, result.FileHistories[key], 4, key, true)
+			yaml.PrintMatrix(writer, result.FileHistories[key], 4, key, true)
 		}
 	}
 
 	if len(result.PeopleHistories) > 0 {
 		fmt.Fprintln(writer, "  people_sequence:")
 		for key := range result.PeopleHistories {
-			fmt.Fprintln(writer, "    - "+stdout.SafeString(analyser.reversedPeopleDict[key]))
+			fmt.Fprintln(writer, "    - "+yaml.SafeString(analyser.reversedPeopleDict[key]))
 		}
 		fmt.Fprintln(writer, "  people:")
 		for key, val := range result.PeopleHistories {
-			stdout.PrintMatrix(writer, val, 4, analyser.reversedPeopleDict[key], true)
+			yaml.PrintMatrix(writer, val, 4, analyser.reversedPeopleDict[key], true)
 		}
 		fmt.Fprintln(writer, "  people_interaction: |-")
-		stdout.PrintMatrix(writer, result.PeopleMatrix, 4, "", false)
+		yaml.PrintMatrix(writer, result.PeopleMatrix, 4, "", false)
 	}
 }
 

+ 5 - 5
couples.go

@@ -10,7 +10,7 @@ import (
 	"gopkg.in/src-d/go-git.v4/plumbing/object"
 	"gopkg.in/src-d/go-git.v4/utils/merkletrie"
 	"gopkg.in/src-d/hercules.v3/pb"
-	"gopkg.in/src-d/hercules.v3/stdout"
+	"gopkg.in/src-d/hercules.v3/yaml"
 )
 
 type CouplesAnalysis struct {
@@ -197,7 +197,7 @@ func (couples *CouplesAnalysis) serializeText(result *CouplesResult, writer io.W
 	fmt.Fprintln(writer, "  files_coocc:")
 	fmt.Fprintln(writer, "    index:")
 	for _, file := range result.Files {
-		fmt.Fprintf(writer, "      - %s\n", stdout.SafeString(file))
+		fmt.Fprintf(writer, "      - %s\n", yaml.SafeString(file))
 	}
 
 	fmt.Fprintln(writer, "    matrix:")
@@ -220,7 +220,7 @@ func (couples *CouplesAnalysis) serializeText(result *CouplesResult, writer io.W
 	fmt.Fprintln(writer, "  people_coocc:")
 	fmt.Fprintln(writer, "    index:")
 	for _, person := range couples.reversedPeopleDict {
-		fmt.Fprintf(writer, "      - %s\n", stdout.SafeString(person))
+		fmt.Fprintf(writer, "      - %s\n", yaml.SafeString(person))
 	}
 
 	fmt.Fprintln(writer, "    matrix:")
@@ -243,10 +243,10 @@ func (couples *CouplesAnalysis) serializeText(result *CouplesResult, writer io.W
 	fmt.Fprintln(writer, "    author_files:") // sorted by number of files each author changed
 	peopleFiles := sortByNumberOfFiles(result.PeopleFiles, couples.reversedPeopleDict, result.Files)
 	for _, authorFiles := range peopleFiles {
-		fmt.Fprintf(writer, "      - %s:\n", stdout.SafeString(authorFiles.Author))
+		fmt.Fprintf(writer, "      - %s:\n", yaml.SafeString(authorFiles.Author))
 		sort.Strings(authorFiles.Files)
 		for _, file := range authorFiles.Files {
-			fmt.Fprintf(writer, "        - %s\n", stdout.SafeString(file)) // sorted by path
+			fmt.Fprintf(writer, "        - %s\n", yaml.SafeString(file)) // sorted by path
 		}
 	}
 }

+ 1 - 1
stdout/utils.go

@@ -1,4 +1,4 @@
-package stdout
+package yaml
 
 import (
 	"fmt"