chore: code formatting
This commit is contained in:
@@ -89,7 +89,7 @@ export default async function({login, graphql, rest, data, q, queries, imports,
|
||||
}
|
||||
//Query contributions collection over account lifetime instead of last year
|
||||
if (account === "user") {
|
||||
if ((indepth) && (imports.metadata.plugins.base.extras("indepth", {...conf.settings, error:false}))) {
|
||||
if ((indepth) && (imports.metadata.plugins.base.extras("indepth", {...conf.settings, error: false}))) {
|
||||
const fields = ["totalRepositoriesWithContributedCommits", "totalCommitContributions", "restrictedContributionsCount", "totalIssueContributions", "totalPullRequestContributions", "totalPullRequestReviewContributions"]
|
||||
const start = new Date(data.user.createdAt)
|
||||
const end = new Date()
|
||||
|
||||
@@ -37,6 +37,6 @@ export default async function({login, q, imports, data, account}, {enabled = fal
|
||||
}
|
||||
//Handle errors
|
||||
catch (error) {
|
||||
throw imports.format.error(error, {title:"Screenshot error"})
|
||||
throw imports.format.error(error, {title: "Screenshot error"})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export default async function({login, data, computed, imports, q, graphql, queri
|
||||
}
|
||||
|
||||
//Indepth mode
|
||||
if ((indepth)&&(imports.metadata.plugins.followup.extras("indepth", {extras}))) {
|
||||
if ((indepth) && (imports.metadata.plugins.followup.extras("indepth", {extras}))) {
|
||||
console.debug(`metrics/compute/${login}/plugins > followup > indepth`)
|
||||
followup.indepth = {repositories: {}}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ export default async function({login, data, rest, imports, q, account}, {enabled
|
||||
}
|
||||
|
||||
//Linguist
|
||||
if ((charts)&&((imports.metadata.plugins.habits.extras("charts", {extras, error:false})))) {
|
||||
if ((charts) && (imports.metadata.plugins.habits.extras("charts", {extras, error: false}))) {
|
||||
//Check if linguist exists
|
||||
console.debug(`metrics/compute/${login}/plugins > habits > searching recently used languages using linguist`)
|
||||
if (patches.length) {
|
||||
@@ -113,7 +113,7 @@ export default async function({login, data, rest, imports, q, account}, {enabled
|
||||
}
|
||||
|
||||
//Generating charts with chartist
|
||||
if ((_charts === "chartist")&&(imports.metadata.plugins.habits.extras("charts.type", {extras}))) {
|
||||
if ((_charts === "chartist") && (imports.metadata.plugins.habits.extras("charts.type", {extras}))) {
|
||||
console.debug(`metrics/compute/${login}/plugins > habits > generating charts`)
|
||||
habits.charts = await Promise.all([
|
||||
{type: "line", data: {...empty(24), ...Object.fromEntries(Object.entries(habits.commits.hours).filter(([k]) => !Number.isNaN(+k)))}, low: 0, high: habits.commits.hours.max},
|
||||
|
||||
@@ -76,7 +76,7 @@ export default async function({login, data, imports, q, rest, account}, {enabled
|
||||
}
|
||||
|
||||
//Indepth mode
|
||||
if ((indepth)&&(imports.metadata.plugins.languages.extras("indepth", {extras}))) {
|
||||
if ((indepth) && (imports.metadata.plugins.languages.extras("indepth", {extras}))) {
|
||||
//Fetch gpg keys (web-flow is GitHub's public key when making changes from web ui)
|
||||
const gpg = []
|
||||
try {
|
||||
|
||||
@@ -33,7 +33,7 @@ export default async function({login, q, imports, rest, graphql, data, account,
|
||||
console.debug(`metrics/compute/${login}/plugins > notable > found ${contributions.length} notable contributions`)
|
||||
|
||||
//Indepth
|
||||
if ((indepth)&&(imports.metadata.plugins.notable.extras("indepth", {extras}))) {
|
||||
if ((indepth) && (imports.metadata.plugins.notable.extras("indepth", {extras}))) {
|
||||
console.debug(`metrics/compute/${login}/plugins > notable > indepth`)
|
||||
|
||||
//Fetch issues
|
||||
|
||||
@@ -47,13 +47,18 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
||||
}
|
||||
//Handle errors
|
||||
catch (error) {
|
||||
throw imports.format.error(error, {descriptions:{"429":'(consider using "plugin_pagespeed_token")', custom(error) {
|
||||
const description = error.response?.data?.error?.message?.match(/Lighthouse returned error: (?<description>[A-Z_]+)/)?.groups?.description ?? null
|
||||
if (description) {
|
||||
const status = error.response?.status
|
||||
return `API error: ${status} (${description})`
|
||||
}
|
||||
return null
|
||||
}}})
|
||||
throw imports.format.error(error, {
|
||||
descriptions: {
|
||||
"429": '(consider using "plugin_pagespeed_token")',
|
||||
custom(error) {
|
||||
const description = error.response?.data?.error?.message?.match(/Lighthouse returned error: (?<description>[A-Z_]+)/)?.groups?.description ?? null
|
||||
if (description) {
|
||||
const status = error.response?.status
|
||||
return `API error: ${status} (${description})`
|
||||
}
|
||||
return null
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,10 +66,14 @@ export default async function({login, data, imports, graphql, q, queries, accoun
|
||||
}
|
||||
//Handle errors
|
||||
catch (error) {
|
||||
throw imports.format.error(error, {descriptions:{custom(error) {
|
||||
if (error.errors?.map(({type}) => type)?.includes("INSUFFICIENT_SCOPES"))
|
||||
return "Insufficient token scopes"
|
||||
return null
|
||||
}}})
|
||||
throw imports.format.error(error, {
|
||||
descriptions: {
|
||||
custom(error) {
|
||||
if (error.errors?.map(({type}) => type)?.includes("INSUFFICIENT_SCOPES"))
|
||||
return "Insufficient token scopes"
|
||||
return null
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export default async function({login, graphql, data, imports, q, queries, accoun
|
||||
|
||||
//Generating charts
|
||||
let charts = null
|
||||
if ((_charts === "chartist")&&(imports.metadata.plugins.stargazers.extras("charts.type", {extras}))) {
|
||||
if ((_charts === "chartist") && (imports.metadata.plugins.stargazers.extras("charts.type", {extras}))) {
|
||||
console.debug(`metrics/compute/${login}/plugins > stargazers > generating charts`)
|
||||
charts = await Promise.all([{data: total, low: total.min, high: total.max}, {data: increments, ref: 0, low: increments.min, high: increments.max, sign: true}].map(({data: {dates: set}, high, low, ref, sign = false}) =>
|
||||
imports.chartist("line", {
|
||||
|
||||
@@ -27,6 +27,6 @@ export default async function({login, imports, data, rest, q, account}, {enabled
|
||||
}
|
||||
//Handle errors
|
||||
catch (error) {
|
||||
throw imports.format.error(error, {descriptions:{"403":"Insufficient token scopes"}})
|
||||
throw imports.format.error(error, {descriptions: {"403": "Insufficient token scopes"}})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user