Skip to content

Commit 8d2a353

Browse files
committed
Changes in the README
1 parent 29dc81f commit 8d2a353

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ Using [linguist/samples](https://github.com/github/linguist/tree/master/samples)
140140
* all files for SQL language fall to the classifier because we don't parse this [disambiguator expresion](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb#L433) for `*.sql` files right. This expression doesn't comply with the pattern for the rest of [heuristics.rb](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) file.
141141

142142

143+
143144
Benchmarks
144145
------------
145146

@@ -172,7 +173,8 @@ to get time averages for main detection function and strategies for the whole sa
172173
if you want see measures by sample file
173174

174175

175-
.gitAttributes
176+
177+
.gitattributes
176178
--------------
177179

178180
Like in linguist you can override the strategies via `.gitattributes` file.
@@ -183,7 +185,7 @@ Add a `.gitattributes` file to the directory and use the same matchers that you
183185
Use the `linguist-vendored` attribute to vendor or un-vendor paths.
184186

185187
```
186-
$cat .gitattributes
188+
$ cat .gitattributes
187189
this-is-a-vendor-directory/ linguist-vendored
188190
this-is-not/ linguist-vendored=false
189191
```
@@ -196,10 +198,11 @@ Documentation works the same way as vendored code but using `linguist-documentat
196198
If you want some files to be classified according to certain language use `linguist-language=[language]`.
197199

198200
```
199-
$cat .gitattributes
201+
$ cat .gitattributes
200202
.*\.go linguist-language=MyFavouriteLanguage
201203
```
202-
Note, that the regular expression that match the file name should be one compatible with go, see: [Golang regexp](https://golang.org/pkg/regexp/).
204+
205+
Note that the regular expression that matches the file name should be compatible with go, see: [Golang regexp](https://golang.org/pkg/regexp/).
203206

204207

205208
Why Enry?

cli/enry/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func main() {
8181
}
8282

8383
language := gitAttributes.GetLanguage(filepath.Base(path))
84-
if len(language) == 0 {
84+
if language == enry.OtherLanguage {
8585
language = enry.GetLanguage(filepath.Base(path), content)
8686
if language == enry.OtherLanguage {
8787
return nil

utils_test.go

+32
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,35 @@ func (s *EnryTestSuite) TestIsBinary() {
7979
assert.Equal(s.T(), is, test.expected, fmt.Sprintf("%v: is = %v, expected: %v", test.name, is, test.expected))
8080
}
8181
}
82+
83+
func (s *EnryTestSuite) TestIdDot() {
84+
tests := []struct {
85+
name string
86+
path string
87+
expected bool
88+
}{
89+
{name: "TestIsDot_1", path: "foo/var/.dotfile", expected: true},
90+
{name: "TestIsDot_2", path: "foo/var/file", expected: false},
91+
{name: "TestIsDot_3", path: "foo/var/file.dot", expected: false},
92+
}
93+
for _, test := range tests {
94+
is := IsDotFile(test.path)
95+
assert.Equal(s.T(), is, test.expected, fmt.Sprintf("%v: is = %v, expected: %v", test.name, is, test.expected))
96+
}
97+
}
98+
99+
func (s *EnryTestSuite) TestIsAuxiliaryLanguage() {
100+
tests := []struct {
101+
name string
102+
lang string
103+
expected bool
104+
}{
105+
{name: "TestIsAuxilaryLang_1", lang: "YAML", expected: true},
106+
{name: "TestIsAuxilaryLang_2", lang: "Go", expected: false},
107+
{name: "TestIsAuxilaryLang_3", lang: "JSON", expected: true},
108+
}
109+
for _, test := range tests {
110+
is := IsAuxiliaryLanguage(test.lang)
111+
assert.Equal(s.T(), is, test.expected, fmt.Sprintf("%v: is = %v, expected: %v", test.name, is, test.expected))
112+
}
113+
}

0 commit comments

Comments
 (0)