chore: fmt
This commit is contained in:
@@ -81,7 +81,6 @@ rules:
|
||||
no-multiple-empty-lines: error
|
||||
no-multi-str: error
|
||||
no-multi-assign: error
|
||||
no-inline-comments: error
|
||||
yoda: error
|
||||
max-classes-per-file: [error, 1]
|
||||
grouped-accessor-pairs: error
|
||||
@@ -116,9 +115,6 @@ rules:
|
||||
quotes: [error, double, {avoidEscape: true}]
|
||||
template-curly-spacing: error
|
||||
|
||||
# Coding style (comments rules)
|
||||
line-comment-position: error
|
||||
|
||||
# Coding style (spacing rules)
|
||||
block-spacing: [error, always]
|
||||
comma-spacing: error
|
||||
|
||||
@@ -233,9 +233,7 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) {
|
||||
comment: "",
|
||||
descriptor: yaml.dump({
|
||||
[key]: Object.fromEntries(
|
||||
Object.entries(value).filter(([key]) => ["description", "default", "required"].includes(key)).map(([k, v]) =>
|
||||
k === "description" ? [k, v.split("\n")[0]] : k === "default" ? [k, ((/^\$\{\{[\s\S]+\}\}$/.test(v)) || (["config_presets", "config_timezone", "use_prebuilt_image"].includes(key))) ? v : "<default-value>"] : [k, v]
|
||||
),
|
||||
Object.entries(value).filter(([key]) => ["description", "default", "required"].includes(key)).map(([k, v]) => k === "description" ? [k, v.split("\n")[0]] : k === "default" ? [k, ((/^\$\{\{[\s\S]+\}\}$/.test(v)) || (["config_presets", "config_timezone", "use_prebuilt_image"].includes(key))) ? v : "<default-value>"] : [k, v]),
|
||||
),
|
||||
}, {quotingType: '"', noCompatMode: true}),
|
||||
},
|
||||
|
||||
@@ -238,13 +238,9 @@
|
||||
` template: ${this.templates.selected}`,
|
||||
` base: ${Object.entries(this.plugins.enabled.base).filter(([key, value]) => value).map(([key]) => key).join(", ") || '""'}`,
|
||||
...[
|
||||
...Object.entries(this.plugins.options).filter(([key, value]) => (key in metadata.base.web) && (value !== metadata.base.web[key]?.defaulted)).map(([key, value]) =>
|
||||
` ${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`
|
||||
),
|
||||
...Object.entries(this.plugins.options).filter(([key, value]) => (key in metadata.base.web) && (value !== metadata.base.web[key]?.defaulted)).map(([key, value]) => ` ${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`),
|
||||
...Object.entries(this.plugins.enabled).filter(([key, value]) => (key !== "base") && (value)).map(([key]) => ` plugin_${key}: yes`),
|
||||
...Object.entries(this.plugins.options).filter(([key, value]) => value).filter(([key, value]) => this.plugins.enabled[key.split(".")[0]]).map(([key, value]) =>
|
||||
` plugin_${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`
|
||||
),
|
||||
...Object.entries(this.plugins.options).filter(([key, value]) => value).filter(([key, value]) => this.plugins.enabled[key.split(".")[0]]).map(([key, value]) => ` plugin_${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`),
|
||||
...Object.entries(this.config).filter(([key, value]) => (value) && (value !== metadata.core.web[key]?.defaulted)).map(([key, value]) => ` config_${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`),
|
||||
].sort(),
|
||||
].join("\n")
|
||||
|
||||
@@ -402,8 +402,7 @@
|
||||
status: "modified",
|
||||
additions: faker.datatype.number(50),
|
||||
deletions: faker.datatype.number(50),
|
||||
patch:
|
||||
`<span class="token coord">@@ -0,0 +1,5 @@</span><br> //Imports<br><span class="token inserted">+ import app from "./src/app.mjs"</span><br><span class="token deleted">- import app from "./src/app.js"</span><br> //Start app<br> await app()<br>\\ No newline at end of file`,
|
||||
patch: `<span class="token coord">@@ -0,0 +1,5 @@</span><br> //Imports<br><span class="token inserted">+ import app from "./src/app.mjs"</span><br><span class="token deleted">- import app from "./src/app.js"</span><br> //Start app<br> await app()<br>\\ No newline at end of file`,
|
||||
repo: `${faker.random.word()}/${faker.random.word()}`,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -128,9 +128,7 @@ export default async function({login, data, imports, q, rest, account}, {enabled
|
||||
//Compute languages stats
|
||||
for (const {section, stats = {}, lines = {}, missed = {bytes: 0}, total = 0} of [{section: "favorites", stats: languages.stats, lines: languages.lines, total: languages.total, missed: languages.missed}, {section: "recent", ...languages["stats.recent"]}]) {
|
||||
console.debug(`metrics/compute/${login}/plugins > languages > computing stats ${section}`)
|
||||
languages[section] = Object.entries(stats).filter(([name]) => !ignored.includes(name.toLocaleLowerCase())).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 / total > threshold
|
||||
)
|
||||
languages[section] = Object.entries(stats).filter(([name]) => !ignored.includes(name.toLocaleLowerCase())).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 / total > threshold)
|
||||
if (other) {
|
||||
let value = indepth ? missed.bytes : Object.entries(stats).filter(([name]) => !Object.values(languages[section]).map(({name}) => name).includes(name)).reduce((a, [_, b]) => a + b, 0)
|
||||
if (value) {
|
||||
|
||||
@@ -23,9 +23,7 @@ export default async function({login, data, imports, rest, q, account}, {enabled
|
||||
//Get contributors stats from repositories
|
||||
console.debug(`metrics/compute/${login}/plugins > lines > querying api`)
|
||||
const lines = {added: 0, deleted: 0, changed: 0}
|
||||
const response = [...await Promise.allSettled(repositories.map(({repo, owner}) => (skipped.includes(repo.toLocaleLowerCase())) || (skipped.includes(`${owner}/${repo}`.toLocaleLowerCase())) ? {} : rest.repos.getContributorsStats({owner, repo})))].filter(({status}) =>
|
||||
status === "fulfilled"
|
||||
).map(({value}) => value)
|
||||
const response = [...await Promise.allSettled(repositories.map(({repo, owner}) => (skipped.includes(repo.toLocaleLowerCase())) || (skipped.includes(`${owner}/${repo}`.toLocaleLowerCase())) ? {} : rest.repos.getContributorsStats({owner, repo})))].filter(({status}) => status === "fulfilled").map(({value}) => value)
|
||||
|
||||
//Compute changed lines
|
||||
console.debug(`metrics/compute/${login}/plugins > lines > computing total diff`)
|
||||
|
||||
@@ -29,9 +29,7 @@ export default async function({login, q, imports, rest, graphql, data, account,
|
||||
}
|
||||
|
||||
//Set contributions
|
||||
contributions = (await Promise.all(contributions.map(async ({handle, stars, issues, pulls, avatarUrl, organization}) => ({name: handle.split("/").shift(), handle, stars, issues, pulls, avatar: await imports.imgb64(avatarUrl), organization})))).sort((a, b) =>
|
||||
a.name.localeCompare(b.name)
|
||||
)
|
||||
contributions = (await Promise.all(contributions.map(async ({handle, stars, issues, pulls, avatarUrl, organization}) => ({name: handle.split("/").shift(), handle, stars, issues, pulls, avatar: await imports.imgb64(avatarUrl), organization})))).sort((a, b) => a.name.localeCompare(b.name))
|
||||
console.debug(`metrics/compute/${login}/plugins > notable > found ${contributions.length} notable contributions`)
|
||||
|
||||
//Extras features
|
||||
|
||||
@@ -16,9 +16,7 @@ export default async function({login, imports, data, rest, q, account}, {enabled
|
||||
//Get views stats from repositories
|
||||
console.debug(`metrics/compute/${login}/plugins > traffic > querying api`)
|
||||
const views = {count: 0, uniques: 0}
|
||||
const response = [...await Promise.allSettled(repositories.map(({repo, owner}) => (skipped.includes(repo.toLocaleLowerCase())) || (skipped.includes(`${owner}/${repo}`.toLocaleLowerCase())) ? {} : rest.repos.getViews({owner, repo})))].filter(({status}) =>
|
||||
status === "fulfilled"
|
||||
).map(({value}) => value)
|
||||
const response = [...await Promise.allSettled(repositories.map(({repo, owner}) => (skipped.includes(repo.toLocaleLowerCase())) || (skipped.includes(`${owner}/${repo}`.toLocaleLowerCase())) ? {} : rest.repos.getViews({owner, repo})))].filter(({status}) => status === "fulfilled").map(({value}) => value)
|
||||
|
||||
//Compute views
|
||||
console.debug(`metrics/compute/${login}/plugins > traffic > computing stats`)
|
||||
|
||||
@@ -44,6 +44,5 @@ describe("Check files editions (checkout your files if needed)", () => {
|
||||
|
||||
//Templates editions
|
||||
describe("Check templates editions", () => {
|
||||
test("Use community templates instead (see https://github.com/lowlighter/metrics/tree/master/source/templates/community)", async () =>
|
||||
void expect((await diff()).filter(edited => /^sources[/]templates[/]/.test(edited) && /^source[/]templates[/](?:classic|terminal|markdown|repository|community)[/][\s\S]*$/.test(edited)).length).toBe(0))
|
||||
test("Use community templates instead (see https://github.com/lowlighter/metrics/tree/master/source/templates/community)", async () => void expect((await diff()).filter(edited => /^sources[/]templates[/]/.test(edited) && /^source[/]templates[/](?:classic|terminal|markdown|repository|community)[/][\s\S]*$/.test(edited)).length).toBe(0))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user