chore: code formatting
This commit is contained in:
@@ -141,10 +141,10 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
||||
q = Object.fromEntries([...Object.entries(q).map(([key, value]) => [key.replace(/^plugin_/, "").replace(/_/g, "."), value]), ["base", false]])
|
||||
//Check users errors
|
||||
const warnings = []
|
||||
if ((!Object.keys(Plugins).filter(key => q[key]).length)&&(!parts.length))
|
||||
warnings.push({warning:{message:"No plugin were selected"}})
|
||||
if ((!Object.keys(Plugins).filter(key => q[key]).length) && (!parts.length))
|
||||
warnings.push({warning: {message: "No plugin were selected"}})
|
||||
const ineffective = Object.keys(q).filter(key => (key.includes(".")) && (key.split(".").at(0) !== "base") && (key.split(".").at(0) in Plugins)).filter(key => !q[key.split(".").at(0)])
|
||||
warnings.push(...ineffective.map(key => ({warning:{message:`"${key}" has no effect because "${key.split(".").at(0)}: true" is not set`}})))
|
||||
warnings.push(...ineffective.map(key => ({warning: {message: `"${key}" has no effect because "${key.split(".").at(0)}: true" is not set`}})))
|
||||
//Compute rendering
|
||||
const {rendered} = await metrics({login, q}, {...arguments[1], convert: ["svg", "png", "jpeg"].includes(q["config.output"]) ? q["config.output"] : null, warnings}, arguments[2])
|
||||
console.debug(`metrics/compute/${login}/embed > ${name} > success >>>>>>>>>>>>>>>>>>>>>>`)
|
||||
|
||||
@@ -220,9 +220,9 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) {
|
||||
//Enable state handler
|
||||
{
|
||||
meta.enabled = function(enabled, {extras = {}, error = true} = {}) {
|
||||
if ((process.env.GITHUB_ACTIONS)&&(!enabled))
|
||||
if ((process.env.GITHUB_ACTIONS) && (!enabled))
|
||||
console.warn(`::warning::Plugin "${name}" is currently disabled. Add "plugin_${name}: yes" to your workflow to enable it.`)
|
||||
if ((error)&&(!enabled))
|
||||
if ((error) && (!enabled))
|
||||
throw Object.assign(new Error(`Plugin "${name}" is disabled${process.env.GITHUB_ACTIONS ? "" : " on this server"}`), {enabled: true})
|
||||
return (enabled) && (meta.extras("enabled", {extras, error}))
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ export function formatters({timeZone} = {}) {
|
||||
format.error = function(error, {descriptions = {}, ...attributes} = {}) {
|
||||
try {
|
||||
//Extras features or enable state error
|
||||
if ((error.extras)||(error.enabled))
|
||||
if ((error.extras) || (error.enabled))
|
||||
throw {error: {message: error.message, instance: error}}
|
||||
//Already formatted error
|
||||
if (error.error?.message)
|
||||
|
||||
Reference in New Issue
Block a user