30
30
"XML" : true , "JSON" : true , "TOML" : true , "YAML" : true , "INI" : true , "SQL" : true ,
31
31
}
32
32
33
- vendorGitattributes = map [string ]bool {}
34
- documentationGitattributes = map [string ]bool {}
35
- languageGitattributes = map [* regexp.Regexp ]string {}
33
+ vendorGitAttributes = map [string ]bool {}
34
+ documentationGitAttributes = map [string ]bool {}
35
+ languageGitAttributes = map [* regexp.Regexp ]string {}
36
36
)
37
37
38
38
type OverrideError struct {
@@ -64,7 +64,7 @@ func IsDotFile(path string) bool {
64
64
65
65
// IsVendor returns whether or not path is a vendor path.
66
66
func IsVendor (path string ) bool {
67
- if val , ok := vendorGitattributes [path ]; ok {
67
+ if val , ok := vendorGitAttributes [path ]; ok {
68
68
return val
69
69
}
70
70
@@ -73,7 +73,7 @@ func IsVendor(path string) bool {
73
73
74
74
// IsDocumentation returns whether or not path is a documentation path.
75
75
func IsDocumentation (path string ) bool {
76
- if val , ok := documentationGitattributes [path ]; ok {
76
+ if val , ok := documentationGitAttributes [path ]; ok {
77
77
return val
78
78
}
79
79
@@ -97,14 +97,14 @@ func IsBinary(data []byte) bool {
97
97
}
98
98
99
99
// LoadGitattributes reads and parses the file .gitattributes which overrides the standard strategies
100
- func LoadGitattributes () {
101
- rawAttributes , err := loadRawGitattributes (".gitattributes" )
100
+ func LoadGitAttributes () {
101
+ rawAttributes , err := loadRawGitAttributes (".gitattributes" )
102
102
if err == nil && len (rawAttributes ) > 0 {
103
103
parseAttributes (rawAttributes )
104
104
}
105
105
}
106
106
107
- func loadRawGitattributes (name string ) (map [string ][]string , error ) {
107
+ func loadRawGitAttributes (name string ) (map [string ][]string , error ) {
108
108
gitattributes := map [string ][]string {}
109
109
data , err := ioutil .ReadFile (name )
110
110
if err != nil {
@@ -171,31 +171,31 @@ func parseAttribute(key string, attribute string) error {
171
171
172
172
func processVendorAttr (key string , attribute string ) error {
173
173
var err error
174
- if _ , ok := vendorGitattributes [key ]; ok {
174
+ if _ , ok := vendorGitAttributes [key ]; ok {
175
175
err = & OverrideError {attribute : "vendor" , path : key }
176
176
}
177
177
178
178
switch {
179
179
case attribute == "linguist-vendored" :
180
- vendorGitattributes [key ] = true
180
+ vendorGitAttributes [key ] = true
181
181
case attribute == "linguist-vendored=false" :
182
- vendorGitattributes [key ] = false
182
+ vendorGitAttributes [key ] = false
183
183
}
184
184
185
185
return err
186
186
}
187
187
188
188
func processDocumentationAttr (key string , attribute string ) error {
189
189
var err error
190
- if _ , ok := documentationGitattributes [key ]; ok {
190
+ if _ , ok := documentationGitAttributes [key ]; ok {
191
191
err = & OverrideError {attribute : "documentation" , path : key }
192
192
}
193
193
194
194
switch {
195
195
case attribute == "linguist-documentation" :
196
- documentationGitattributes [key ] = true
196
+ documentationGitAttributes [key ] = true
197
197
case attribute == "linguist-documentation=false" :
198
- documentationGitattributes [key ] = false
198
+ documentationGitAttributes [key ] = false
199
199
}
200
200
201
201
return err
@@ -210,9 +210,9 @@ func processLanguageAttr(regExpString string, attribute string) error {
210
210
}
211
211
lang , _ := GetLanguageByAlias (tokens [1 ])
212
212
if lang != OtherLanguage {
213
- languageGitattributes [regExp ] = lang
213
+ languageGitAttributes [regExp ] = lang
214
214
} else {
215
- languageGitattributes [regExp ] = tokens [1 ]
215
+ languageGitAttributes [regExp ] = tokens [1 ]
216
216
}
217
217
218
218
return nil
0 commit comments