chore: code formatting
This commit is contained in:
@@ -7,7 +7,6 @@ import {filters} from "../../../app/metrics/utils.mjs"
|
|||||||
|
|
||||||
/**Analyzer */
|
/**Analyzer */
|
||||||
export class Analyzer {
|
export class Analyzer {
|
||||||
|
|
||||||
/**Constructor */
|
/**Constructor */
|
||||||
constructor(login, {account = "bypass", authoring = [], uid = Math.random(), shell, rest = null, context = {mode: "user"}, skipped = [], categories = ["programming", "markup"], timeout = {global: NaN, repositories: NaN}}) {
|
constructor(login, {account = "bypass", authoring = [], uid = Math.random(), shell, rest = null, context = {mode: "user"}, skipped = [], categories = ["programming", "markup"], timeout = {global: NaN, repositories: NaN}}) {
|
||||||
//User informations
|
//User informations
|
||||||
@@ -178,5 +177,4 @@ export class Analyzer {
|
|||||||
debug(message) {
|
debug(message) {
|
||||||
return console.debug(`metrics/compute/${this.login}/plugins > languages > ${this.constructor.name.replace(/([a-z])([A-Z])/, (_, a, b) => `${a} ${b.toLocaleLowerCase()}`).toLocaleLowerCase()} > ${message}`)
|
return console.debug(`metrics/compute/${this.login}/plugins > languages > ${this.constructor.name.replace(/([a-z])([A-Z])/, (_, a, b) => `${a} ${b.toLocaleLowerCase()}`).toLocaleLowerCase()} > ${message}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
//Imports
|
//Imports
|
||||||
import { IndepthAnalyzer } from "./indepth.mjs"
|
|
||||||
import { RecentAnalyzer } from "./recent.mjs"
|
|
||||||
import OctokitRest from "@octokit/rest"
|
import OctokitRest from "@octokit/rest"
|
||||||
import yargsparser from "yargs-parser"
|
import yargsparser from "yargs-parser"
|
||||||
|
import { IndepthAnalyzer } from "./indepth.mjs"
|
||||||
|
import { RecentAnalyzer } from "./recent.mjs"
|
||||||
|
|
||||||
const help = `
|
const help = `
|
||||||
|
|
||||||
@@ -22,22 +22,28 @@ export async function cli() {
|
|||||||
const {login, _: repositories, mode = "indepth"} = argv
|
const {login, _: repositories, mode = "indepth"} = argv
|
||||||
const {
|
const {
|
||||||
"commits.authoring": authoring,
|
"commits.authoring": authoring,
|
||||||
} = await metadata.plugins.base.inputs({q:{
|
} = await metadata.plugins.base.inputs({
|
||||||
|
q: {
|
||||||
"commits.authoring": argv["commits-authoring"] || login,
|
"commits.authoring": argv["commits-authoring"] || login,
|
||||||
}, account: "bypass"})
|
},
|
||||||
|
account: "bypass",
|
||||||
|
})
|
||||||
const {
|
const {
|
||||||
categories,
|
categories,
|
||||||
"analysis.timeout": _timeout_global,
|
"analysis.timeout": _timeout_global,
|
||||||
"analysis.timeout.repositories": _timeout_repositories,
|
"analysis.timeout.repositories": _timeout_repositories,
|
||||||
"recent.load": _recent_load,
|
"recent.load": _recent_load,
|
||||||
"recent.days": _recent_days,
|
"recent.days": _recent_days,
|
||||||
} = await metadata.plugins.languages.inputs({q: {
|
} = await metadata.plugins.languages.inputs({
|
||||||
|
q: {
|
||||||
categories: argv.categories || "",
|
categories: argv.categories || "",
|
||||||
"analysis.timeout": argv["timeout-global"] || "",
|
"analysis.timeout": argv["timeout-global"] || "",
|
||||||
"analysis.timeout.repositories": argv["timeout-repositories"] || "",
|
"analysis.timeout.repositories": argv["timeout-repositories"] || "",
|
||||||
"recent.load": argv["recent-load"] || "",
|
"recent.load": argv["recent-load"] || "",
|
||||||
"recent.days": argv["recent-days"] || "",
|
"recent.days": argv["recent-days"] || "",
|
||||||
}, account: "bypass"})
|
},
|
||||||
|
account: "bypass",
|
||||||
|
})
|
||||||
|
|
||||||
//Prepare call
|
//Prepare call
|
||||||
const imports = await import("../../../app/metrics/utils.mjs")
|
const imports = await import("../../../app/metrics/utils.mjs")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
//Imports
|
//Imports
|
||||||
import { Analyzer } from "./analyzer.mjs"
|
|
||||||
import fs from "fs/promises"
|
import fs from "fs/promises"
|
||||||
|
import linguist from "linguist-js"
|
||||||
import os from "os"
|
import os from "os"
|
||||||
import paths from "path"
|
import paths from "path"
|
||||||
import linguist from "linguist-js"
|
import { Analyzer } from "./analyzer.mjs"
|
||||||
|
|
||||||
/**Indepth analyzer */
|
/**Indepth analyzer */
|
||||||
export class IndepthAnalyzer extends Analyzer {
|
export class IndepthAnalyzer extends Analyzer {
|
||||||
@@ -74,9 +74,10 @@ export class IndepthAnalyzer extends Analyzer {
|
|||||||
this.debug(`importing gpg ${id}`)
|
this.debug(`importing gpg ${id}`)
|
||||||
await this.shell.run(`gpg --import ${path}`)
|
await this.shell.run(`gpg --import ${path}`)
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
this.debug("skipping import of gpg keys as we are not in GitHub Actions environment")
|
this.debug("skipping import of gpg keys as we are not in GitHub Actions environment")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
this.debug(`an error occurred while importing gpg ${id}, skipping...`)
|
this.debug(`an error occurred while importing gpg ${id}, skipping...`)
|
||||||
}
|
}
|
||||||
@@ -180,7 +181,7 @@ export class IndepthAnalyzer extends Analyzer {
|
|||||||
catch (error) {
|
catch (error) {
|
||||||
this.debug(`skipping line ${sha}#${cursor} (${error})`)
|
this.debug(`skipping line ${sha}#${cursor} (${error})`)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
return editions
|
return editions
|
||||||
}
|
}
|
||||||
@@ -227,6 +228,4 @@ export class IndepthAnalyzer extends Analyzer {
|
|||||||
result.files = edited.size
|
result.files = edited.size
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Imports
|
//Imports
|
||||||
import { Analyzer } from "./analyzer.mjs"
|
|
||||||
import {filters} from "../../../app/metrics/utils.mjs"
|
|
||||||
import linguist from "linguist-js"
|
import linguist from "linguist-js"
|
||||||
|
import { filters } from "../../../app/metrics/utils.mjs"
|
||||||
|
import { Analyzer } from "./analyzer.mjs"
|
||||||
|
|
||||||
/**Recent analyzer */
|
/**Recent analyzer */
|
||||||
export class RecentAnalyzer extends Analyzer {
|
export class RecentAnalyzer extends Analyzer {
|
||||||
@@ -98,7 +98,7 @@ export class RecentAnalyzer extends Analyzer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return edition
|
return edition
|
||||||
})
|
}),
|
||||||
}))
|
}))
|
||||||
return patches
|
return patches
|
||||||
}
|
}
|
||||||
@@ -140,5 +140,4 @@ export class RecentAnalyzer extends Analyzer {
|
|||||||
result.languages = cache.languages
|
result.languages = cache.languages
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//Imports
|
//Imports
|
||||||
|
import { cli } from "./analyzer/cli.mjs"
|
||||||
import { IndepthAnalyzer } from "./analyzer/indepth.mjs"
|
import { IndepthAnalyzer } from "./analyzer/indepth.mjs"
|
||||||
import { RecentAnalyzer } from "./analyzer/recent.mjs"
|
import { RecentAnalyzer } from "./analyzer/recent.mjs"
|
||||||
import { cli } from "./analyzer/cli.mjs"
|
|
||||||
|
|
||||||
/**Indepth analyzer */
|
/**Indepth analyzer */
|
||||||
export async function indepth({login, data, imports, rest, context, repositories}, {skipped, categories, timeout}) {
|
export async function indepth({login, data, imports, rest, context, repositories}, {skipped, categories, timeout}) {
|
||||||
@@ -15,7 +15,7 @@ export async function recent({login, data, imports, rest, context, account}, {sk
|
|||||||
|
|
||||||
//import.meta.main
|
//import.meta.main
|
||||||
if (/languages.analyzers.mjs$/.test(process.argv[1])) {
|
if (/languages.analyzers.mjs$/.test(process.argv[1])) {
|
||||||
(async () => {
|
;(async () => {
|
||||||
console.log(await cli())
|
console.log(await cli())
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})()
|
})()
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ export default async function({login, data, imports, q, rest, account}, {enabled
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Load inputs
|
//Load inputs
|
||||||
let {ignored, skipped, other, colors, aliases, details, threshold, limit, indepth, "indepth.custom":_indepth_custom, "analysis.timeout": _timeout_global, "analysis.timeout.repositories": _timeout_repositories, sections, categories, "recent.categories": _recent_categories, "recent.load": _recent_load, "recent.days": _recent_days} = imports.metadata.plugins.languages
|
let {ignored, skipped, other, colors, aliases, details, threshold, limit, indepth, "indepth.custom": _indepth_custom, "analysis.timeout": _timeout_global, "analysis.timeout.repositories": _timeout_repositories, sections, categories, "recent.categories": _recent_categories, "recent.load": _recent_load, "recent.days": _recent_days} = imports.metadata
|
||||||
|
.plugins.languages
|
||||||
.inputs({
|
.inputs({
|
||||||
data,
|
data,
|
||||||
account,
|
account,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default async function({faker}, target, that, args) {
|
|||||||
patch: '@@ -0,0 +1,5 @@\n+//Imports\n+ import app from "./src/app.mjs"\n+\n+//Start app\n+ await app()\n\\ No newline at end of file',
|
patch: '@@ -0,0 +1,5 @@\n+//Imports\n+ import app from "./src/app.mjs"\n+\n+//Start app\n+ await app()\n\\ No newline at end of file',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
parents: []
|
parents: [],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user