Set commits analysis case-insenstive #338
This commit is contained in:
@@ -41,7 +41,7 @@ export default async function({login, data, rest, imports, q, account}, {enabled
|
|||||||
...await Promise.allSettled(
|
...await Promise.allSettled(
|
||||||
commits
|
commits
|
||||||
.flatMap(({payload}) => payload.commits)
|
.flatMap(({payload}) => payload.commits)
|
||||||
.filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.email?.includes(authoring)||author?.name?.includes(authoring)).length)
|
.filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.email?.toLocaleLowerCase().includes(authoring)||author?.name?.toLocaleLowerCase().includes(authoring)).length)
|
||||||
.map(async commit => (await rest.request(commit)).data.files),
|
.map(async commit => (await rest.request(commit)).data.files),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -72,11 +72,12 @@ export async function recent({login, data, imports, rest, account}, {skipped, da
|
|||||||
|
|
||||||
//Retrieve edited files and filter edited lines (those starting with +/-) from patches
|
//Retrieve edited files and filter edited lines (those starting with +/-) from patches
|
||||||
console.debug(`metrics/compute/${login}/plugins > languages > loading patches`)
|
console.debug(`metrics/compute/${login}/plugins > languages > loading patches`)
|
||||||
|
console.debug(`metrics/compute/${login}/plugins > languages > commits authoring set to ${JSON.stringify(data.shared["commits.authoring"])}`)
|
||||||
const patches = [
|
const patches = [
|
||||||
...await Promise.allSettled(
|
...await Promise.allSettled(
|
||||||
commits
|
commits
|
||||||
.flatMap(({payload}) => payload.commits)
|
.flatMap(({payload}) => payload.commits)
|
||||||
.filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.email?.includes(authoring)||author?.name?.includes(authoring)).length)
|
.filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.email?.toLocaleLowerCase().includes(authoring)||author?.name?.toLocaleLowerCase().includes(authoring)).length)
|
||||||
.map(commit => commit.url)
|
.map(commit => commit.url)
|
||||||
.map(async commit => (await rest.request(commit)).data.files),
|
.map(async commit => (await rest.request(commit)).data.files),
|
||||||
),
|
),
|
||||||
@@ -101,7 +102,7 @@ export async function recent({login, data, imports, rest, account}, {skipped, da
|
|||||||
//Create temporary git repository
|
//Create temporary git repository
|
||||||
console.debug(`metrics/compute/${login}/plugins > languages > creating temp git repository`)
|
console.debug(`metrics/compute/${login}/plugins > languages > creating temp git repository`)
|
||||||
const git = await imports.git(path)
|
const git = await imports.git(path)
|
||||||
await git.init().add(".").addConfig("user.name", login).addConfig("user.email", "<>").commit("linguist").status()
|
await git.init().add(".").addConfig("user.name", data.shared["commits.authoring"]?.[0] ?? login).addConfig("user.email", "<>").commit("linguist").status()
|
||||||
|
|
||||||
//Analyze repository
|
//Analyze repository
|
||||||
await analyze(arguments[0], {results, path})
|
await analyze(arguments[0], {results, path})
|
||||||
@@ -128,7 +129,7 @@ async function analyze({login, imports, data}, {results, path}) {
|
|||||||
console.debug(`metrics/compute/${login}/plugins > languages > indepth > checking git log`)
|
console.debug(`metrics/compute/${login}/plugins > languages > indepth > checking git log`)
|
||||||
for (let page = 0; ; page++) {
|
for (let page = 0; ; page++) {
|
||||||
try {
|
try {
|
||||||
const stdout = await imports.run(`git log ${data.shared["commits.authoring"].map(authoring => `--author="${authoring}"`).join(" ")} --format="" --patch --max-count=${per_page} --skip=${page*per_page}`, {cwd:path}, {log:false})
|
const stdout = await imports.run(`git log ${data.shared["commits.authoring"].map(authoring => `--author="${authoring}"`).join(" ")} --regexp-ignore-case --format="" --patch --max-count=${per_page} --skip=${page*per_page}`, {cwd:path}, {log:false})
|
||||||
let file = null, lang = null
|
let file = null, lang = null
|
||||||
if (!stdout.trim().length) {
|
if (!stdout.trim().length) {
|
||||||
console.debug(`metrics/compute/${login}/plugins > languages > indepth > no more commits`)
|
console.debug(`metrics/compute/${login}/plugins > languages > indepth > no more commits`)
|
||||||
|
|||||||
Reference in New Issue
Block a user