Add linter and minor bug fixes (#107)

This commit is contained in:
Simon Lecoq
2021-02-05 23:45:48 +01:00
committed by GitHub
parent 61e2f6e1a1
commit 882a93dea5
74 changed files with 1544 additions and 712 deletions

View File

@@ -4,7 +4,7 @@
*/
//Setup
export default async function ({login, graphql, data, q, queries, imports}, conf) {
export default async function({login, graphql, data, q, queries, imports}, conf) {
//Load inputs
console.debug(`metrics/compute/${login}/base > started`)
let {repositories, repositories_forks:forks} = imports.metadata.plugins.base.inputs({data, q, account:"bypass"}, {repositories:conf.settings.repositories ?? 100})
@@ -16,7 +16,7 @@
//Base parts (legacy handling for web instance)
const defaulted = ("base" in q) ? legacy.converter(q.base) ?? true : true
for (const part of conf.settings.plugins.base.parts)
data.base[part] = `base.${part}` in q ? legacy.converter(q[ `base.${part}`]) : defaulted
data.base[part] = `base.${part}` in q ? legacy.converter(q[`base.${part}`]) : defaulted
//Iterate through account types
for (const account of ["user", "organization"]) {
@@ -46,7 +46,8 @@
//Success
console.debug(`metrics/compute/${login}/base > graphql query > account ${account} > success`)
return {}
} catch (error) {
}
catch (error) {
console.debug(`metrics/compute/${login}/base > account ${account} > failed : ${error}`)
console.debug(`metrics/compute/${login}/base > checking next account`)
}
@@ -69,7 +70,7 @@
//Organization
organization({login, data}) {
console.debug(`metrics/compute/${login}/base > applying postprocessing`)
data.account = "organization",
data.account = "organization"
Object.assign(data.user, {
isHireable:false,
starredRepositories:{totalCount:0},
@@ -107,7 +108,7 @@
repositories:{totalCount:0, totalDiskUsage:0, nodes:[]},
packages:{totalCount:0},
})
}
},
}
//Legacy functions
@@ -119,5 +120,5 @@
return false
if (Number.isFinite(Number(value)))
return !!(Number(value))
}
}
},
}