-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace github-linguist
gem with Node port Nixinova/Linguist
#436
Conversation
Using a Node port of Linguist makes language data gathering less prone to breakage as Metrics previously relied on `console.log` output to fetch statistics, where SemVer doesn't apply.
Version 1.4.2 fixes a crash
Version 1.4.3 mandates consistent absolute paths in output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
It'll definitely improve stability of languages plugins 👍
Since the output of Linguist is this ↓, is there anywhere in the languages plugin where language processing can now be simplified? Linguist output schema{
"count": 3,
"results": {
"src/index.ts": "TypeScript",
"src/cli.js": "JavaScript",
"readme.md": "Markdown"
},
"languages": {
"all": {
"JavaScript": { "type": "programming", "bytes": 1000 },
"TypeScript": { "type": "programming", "bytes": 2000 },
"Markdown": { "type": "prose", "bytes": 3000 },
},
"programming": { "JavaScript": 1000, "TypeScript": 2000 },
"markup": {},
"data": {},
"prose": { "Markdown": 3000 },
"unknown": {},
"total": { "unique": 3, "bytes": 6000, "unknownBytes": 0 }
}
} For example I see a couple instances of looped 'results[lang].bytes+=size': metrics/source/plugins/languages/index.mjs Lines 47 to 52 in 3e26d37
(I could also add a |
This loop is for GitHub api data, not for linguist data. It's the non- Linguist is only called in metrics/source/plugins/languages/analyzers.mjs Lines 140 to 142 in 63675f1
Adding the |
I'll make a release soon even if there are still improvements that can be made, since #424 still affects |
I also think the problem in #356 may be covered by my linguist. |
Added in 1.4.4: get from |
This PR was for gathering patches from GitHub events along with their associated repository
Nice 👍 |
Description
Using the
github-linguist
gem directly is a bit of a hack, and any changes to console.log output breaks Metrics, like what happened with the release of v7.16.Nixinova/Linguist is a Node port of
github-linguist
which allows for proper JavaScript language data generation.This change also allows for
prose
anddata
languages to be included in any generated metrics as a new option if so desired.Tests
Refs