File tree Expand file tree Collapse file tree 5 files changed +26
-9
lines changed Expand file tree Collapse file tree 5 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ install:
1616 - go get -v -t ./...
1717
1818script :
19- - make test
19+ - make test-coverage
2020
2121after_success :
2222 - bash <(curl -s https://codecov.io/bash)
Original file line number Diff line number Diff line change 1+ COVERAGE_REPORT := coverage.txt
2+ COVERAGE_PROFILE := profile.out
3+ COVERAGE_MODE := atomic
4+
15LINGUIST_PATH = .linguist
26
37$(LINGUIST_PATH ) :
@@ -6,8 +10,21 @@ $(LINGUIST_PATH):
610test : $(LINGUIST_PATH )
711 go test -v ./...
812
13+ test-coverage : $(LINGUIST_PATH )
14+ @echo " mode: $( COVERAGE_MODE) " > $(COVERAGE_REPORT ) ; \
15+ for dir in ` find . -name " *.go" | grep -o ' .*/' | sort -u | grep -v ' ./.linguist/' ` ; do \
16+ go test $$ dir -coverprofile=$(COVERAGE_PROFILE ) -covermode=$(COVERAGE_MODE ) ; \
17+ if [ $$ ? != 0 ]; then \
18+ exit 2; \
19+ fi ; \
20+ if [ -f $( COVERAGE_PROFILE) ]; then \
21+ tail -n +2 $(COVERAGE_PROFILE ) >> $(COVERAGE_REPORT ) ; \
22+ rm $(COVERAGE_PROFILE ) ; \
23+ fi ; \
24+ done ;
25+
926code-generate : $(LINGUIST_PATH )
1027 go run internal/code-generator/main.go
1128
1229clean :
13- rm -rf $(LINGUIST_PATH )
30+ rm -rf $(LINGUIST_PATH )
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ func main() {
2020 log .Fatal (err )
2121 }
2222
23- enry .LoadGitAttributes ()
23+ enry .LoadGitattributes ()
2424
2525 errors := false
2626 out := make (map [string ][]string , 0 )
Original file line number Diff line number Diff line change @@ -84,20 +84,20 @@ func IsBinary(data []byte) bool {
8484 return true
8585}
8686
87- // LoadGitattributes reads and parse the file .gitattributes wich overrides the standards strategies
87+ // LoadGitattributes reads and parses the file .gitattributes which overrides the standard strategies
8888func LoadGitattributes () {
89- rawAttributes , err := loadGitattributes (".gitattributes" )
89+ rawAttributes , err := loadRawGitattributes (".gitattributes" )
9090 if err == nil && len (rawAttributes ) > 0 {
9191 parseAttributes (rawAttributes )
9292 }
9393}
9494
95- func loadGitattributes (name string ) (map [string ]string , error ) {
95+ func loadRawGitattributes (name string ) (map [string ]string , error ) {
9696 gitattributes := map [string ]string {}
9797 data , err := ioutil .ReadFile (name )
9898 if err != nil {
9999 if err != os .ErrNotExist {
100- log .Println (".gitattributes : " + err .Error ())
100+ log .Println (name + " : " + err .Error ())
101101 }
102102
103103 return nil , err
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ func (s *EnryTestSuite) TestIsBinary() {
8282 }
8383}
8484
85- func (s * SimpleLinguistTestSuite ) TestLoadLine () {
85+ func (s * EnryTestSuite ) TestLoadLine () {
8686 tests := []struct {
8787 name string
8888 line string
@@ -101,7 +101,7 @@ func (s *SimpleLinguistTestSuite) TestLoadLine() {
101101 }
102102}
103103
104- func (s * SimpleLinguistTestSuite ) TestParseAttributes () {
104+ func (s * EnryTestSuite ) TestParseAttributes () {
105105 tests := []struct {
106106 name string
107107 attributes map [string ]string
You can’t perform that action at this time.
0 commit comments