Add indepth languages analysis (#325)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
//Imports
|
||||
import indepth_analyzer from "./indepth.mjs"
|
||||
|
||||
//Setup
|
||||
export default async function({login, data, imports, q, account}, {enabled = false} = {}) {
|
||||
//Plugin execution
|
||||
@@ -7,7 +10,7 @@ export default async function({login, data, imports, q, account}, {enabled = fal
|
||||
return null
|
||||
|
||||
//Load inputs
|
||||
let {ignored, skipped, colors, details, threshold, limit} = imports.metadata.plugins.languages.inputs({data, account, q})
|
||||
let {ignored, skipped, colors, details, threshold, limit, indepth} = imports.metadata.plugins.languages.inputs({data, account, q})
|
||||
threshold = (Number(threshold.replace(/%$/, "")) || 0) / 100
|
||||
skipped.push(...data.shared["repositories.skipped"])
|
||||
if (!limit)
|
||||
@@ -43,6 +46,12 @@ export default async function({login, data, imports, q, account}, {enabled = fal
|
||||
}
|
||||
}
|
||||
|
||||
//Indepth mode
|
||||
if (indepth) {
|
||||
console.debug(`metrics/compute/${login}/plugins > languages > switching to indepth mode (this may take some time)`)
|
||||
Object.assign(languages, await indepth_analyzer({login, data, imports}, {skipped, ignored}))
|
||||
}
|
||||
|
||||
//Compute languages stats
|
||||
console.debug(`metrics/compute/${login}/plugins > languages > computing stats`)
|
||||
languages.favorites = Object.entries(languages.stats).sort(([_an, a], [_bn, b]) => b - a).slice(0, limit).map(([name, value]) => ({name, value, size:value, color:languages.colors[name], x:0})).filter(({value}) => value / languages.total > threshold)
|
||||
|
||||
Reference in New Issue
Block a user