Skip to content

Update enry dependency to 1.7.2#731

Merged
ajnavarro merged 1 commit intosrc-d:masterfrom
kuba--:langs
Mar 19, 2019
Merged

Update enry dependency to 1.7.2#731
ajnavarro merged 1 commit intosrc-d:masterfrom
kuba--:langs

Conversation

@kuba--
Copy link
Contributor

@kuba-- kuba-- commented Mar 13, 2019

Signed-off-by: kuba-- [email protected]

This PR improves accuracy for language function. So far, we used only enry.GetLanguage what for .h files returns an empty string. The PR tries (4 times) to get a language by cascade of functions (GetLanguage, GetLanguageByContent, GetLanguageByFilename, GetLanguageByExtension).

@kuba-- kuba-- requested a review from a team March 13, 2019 19:22
@kuba-- kuba-- added the proposal proposal for new additions or changes label Mar 13, 2019
return l
}
return ""
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already done by enry.GetLanguage as far as I know.

enry.GetLanguage calls enry.GetLanguages (https://github.com/src-d/enry/blob/master/common.go#L121) which calls all these strategies: https://github.com/src-d/enry/blob/master/common.go#L20-L27

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so I'll change it and just call GetLanguages, because so far GetLanguage doesn't check if returned string is empty.
My intention was to add support for .h (c header files) which is missed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bug in enry: https://github.com/src-d/enry/blob/master/common.go#L139
It populates a list of candidates but returns an empty slice of languages.

@kuba--
Copy link
Contributor Author

kuba-- commented Mar 14, 2019

First it needs to be fixed by enry: src-d/enry#205

@kuba-- kuba-- added the blocked Some other issue is blocking this label Mar 15, 2019
@bzz
Copy link
Contributor

bzz commented Mar 15, 2019

enry v1.7.2 is out

Signed-off-by: kuba-- <[email protected]>

Upgrade enry to v1.7.2

Signed-off-by: kuba-- <[email protected]>
@ajnavarro ajnavarro changed the title improve language function Update enry dependency to 1.7.2 Mar 19, 2019
@ajnavarro ajnavarro merged commit 29c87e6 into src-d:master Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Some other issue is blocking this proposal proposal for new additions or changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants