chore: code formatting
This commit is contained in:
@@ -7,7 +7,6 @@ import {filters} from "../../../app/metrics/utils.mjs"
|
||||
|
||||
/**Analyzer */
|
||||
export class Analyzer {
|
||||
|
||||
/**Constructor */
|
||||
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
|
||||
@@ -178,5 +177,4 @@ export class Analyzer {
|
||||
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}`)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//Imports
|
||||
import { IndepthAnalyzer } from "./indepth.mjs"
|
||||
import { RecentAnalyzer } from "./recent.mjs"
|
||||
import OctokitRest from "@octokit/rest"
|
||||
import yargsparser from "yargs-parser"
|
||||
import { IndepthAnalyzer } from "./indepth.mjs"
|
||||
import { RecentAnalyzer } from "./recent.mjs"
|
||||
|
||||
const help = `
|
||||
|
||||
@@ -22,22 +22,28 @@ export async function cli() {
|
||||
const {login, _: repositories, mode = "indepth"} = argv
|
||||
const {
|
||||
"commits.authoring": authoring,
|
||||
} = await metadata.plugins.base.inputs({q:{
|
||||
} = await metadata.plugins.base.inputs({
|
||||
q: {
|
||||
"commits.authoring": argv["commits-authoring"] || login,
|
||||
}, account: "bypass"})
|
||||
},
|
||||
account: "bypass",
|
||||
})
|
||||
const {
|
||||
categories,
|
||||
"analysis.timeout": _timeout_global,
|
||||
"analysis.timeout.repositories": _timeout_repositories,
|
||||
"recent.load": _recent_load,
|
||||
"recent.days": _recent_days,
|
||||
} = await metadata.plugins.languages.inputs({q: {
|
||||
} = await metadata.plugins.languages.inputs({
|
||||
q: {
|
||||
categories: argv.categories || "",
|
||||
"analysis.timeout": argv["timeout-global"] || "",
|
||||
"analysis.timeout.repositories": argv["timeout-repositories"] || "",
|
||||
"recent.load": argv["recent-load"] || "",
|
||||
"recent.days": argv["recent-days"] || "",
|
||||
}, account: "bypass"})
|
||||
},
|
||||
account: "bypass",
|
||||
})
|
||||
|
||||
//Prepare call
|
||||
const imports = await import("../../../app/metrics/utils.mjs")
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//Imports
|
||||
import { Analyzer } from "./analyzer.mjs"
|
||||
import fs from "fs/promises"
|
||||
import linguist from "linguist-js"
|
||||
import os from "os"
|
||||
import paths from "path"
|
||||
import linguist from "linguist-js"
|
||||
import { Analyzer } from "./analyzer.mjs"
|
||||
|
||||
/**Indepth analyzer */
|
||||
export class IndepthAnalyzer extends Analyzer {
|
||||
@@ -74,9 +74,10 @@ export class IndepthAnalyzer extends Analyzer {
|
||||
this.debug(`importing gpg ${id}`)
|
||||
await this.shell.run(`gpg --import ${path}`)
|
||||
}
|
||||
else
|
||||
else {
|
||||
this.debug("skipping import of gpg keys as we are not in GitHub Actions environment")
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
this.debug(`an error occurred while importing gpg ${id}, skipping...`)
|
||||
}
|
||||
@@ -180,7 +181,7 @@ export class IndepthAnalyzer extends Analyzer {
|
||||
catch (error) {
|
||||
this.debug(`skipping line ${sha}#${cursor} (${error})`)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
return editions
|
||||
}
|
||||
@@ -227,6 +228,4 @@ export class IndepthAnalyzer extends Analyzer {
|
||||
result.files = edited.size
|
||||
return result
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//Imports
|
||||
import { Analyzer } from "./analyzer.mjs"
|
||||
import {filters} from "../../../app/metrics/utils.mjs"
|
||||
import linguist from "linguist-js"
|
||||
import { filters } from "../../../app/metrics/utils.mjs"
|
||||
import { Analyzer } from "./analyzer.mjs"
|
||||
|
||||
/**Recent analyzer */
|
||||
export class RecentAnalyzer extends Analyzer {
|
||||
@@ -98,7 +98,7 @@ export class RecentAnalyzer extends Analyzer {
|
||||
}
|
||||
}
|
||||
return edition
|
||||
})
|
||||
}),
|
||||
}))
|
||||
return patches
|
||||
}
|
||||
@@ -140,5 +140,4 @@ export class RecentAnalyzer extends Analyzer {
|
||||
result.languages = cache.languages
|
||||
return result
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//Imports
|
||||
import { cli } from "./analyzer/cli.mjs"
|
||||
import { IndepthAnalyzer } from "./analyzer/indepth.mjs"
|
||||
import { RecentAnalyzer } from "./analyzer/recent.mjs"
|
||||
import { cli } from "./analyzer/cli.mjs"
|
||||
|
||||
/**Indepth analyzer */
|
||||
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
|
||||
if (/languages.analyzers.mjs$/.test(process.argv[1])) {
|
||||
(async () => {
|
||||
;(async () => {
|
||||
console.log(await cli())
|
||||
process.exit(0)
|
||||
})()
|
||||
|
||||
@@ -18,7 +18,8 @@ export default async function({login, data, imports, q, rest, account}, {enabled
|
||||
}
|
||||
|
||||
//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({
|
||||
data,
|
||||
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',
|
||||
},
|
||||
],
|
||||
parents: []
|
||||
parents: [],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user