Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/plugins/languages/analyzer/recent.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class RecentAnalyzer extends Analyzer {
...await Promise.allSettled(
commits
.flatMap(({payload}) => payload.commits)
.filter(({committer}) => filters.text(committer?.email, this.authoring, {debug: false}))
.filter(commit => commit && filters.text(commit.committer?.email, this.authoring, {debug: false}))
.map(commit => commit.url)
.map(async commit => (await this.rest.request(commit)).data),
),
Expand Down
4 changes: 2 additions & 2 deletions source/plugins/lines/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default async function({login, data, imports, rest, q, account}, {enabled
return
//Compute changes
repos[handle] = {added: 0, deleted: 0, changed: 0}
const contributors = stats.filter(({author}) => (context.mode === "repository") || (context.mode === "organization") ? true : author?.login?.toLocaleLowerCase() === login.toLocaleLowerCase())
const contributors = stats.filter(contributors => contributors && ((context.mode === "repository") || (context.mode === "organization") ? true : contributors.author?.login?.toLocaleLowerCase() === login.toLocaleLowerCase()))
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title/description focuses on the languages recent analyzer TypeError, but this PR also changes the lines plugin contributor filtering/logging. If this is intentional (same class of undefined entries), consider mentioning it in the PR description so reviewers understand the additional scope.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stats.filter(contributors => ...) callback parameter name (contributors) is plural and also very close to the outer contributors array constant, which makes this line harder to read and easier to mis-edit later. Rename the callback parameter to contributor (or similar) to avoid shadowing/confusion.

Suggested change
const contributors = stats.filter(contributors => contributors && ((context.mode === "repository") || (context.mode === "organization") ? true : contributors.author?.login?.toLocaleLowerCase() === login.toLocaleLowerCase()))
const contributors = stats.filter(contributor => contributor && ((context.mode === "repository") || (context.mode === "organization") ? true : contributor.author?.login?.toLocaleLowerCase() === login.toLocaleLowerCase()))

Copilot uses AI. Check for mistakes.
for (const contributor of contributors) {
let added = 0, changed = 0, deleted = 0
contributor.weeks.forEach(({a = 0, d = 0, c = 0, w}) => {
Expand All @@ -59,7 +59,7 @@ export default async function({login, data, imports, rest, q, account}, {enabled
weeks[date].deleted += d
weeks[date].changed += c
})
console.debug(`metrics/compute/${login}/plugins > lines > ${handle}: @${contributor.author.login} +${added} -${deleted} ~${changed}`)
console.debug(`metrics/compute/${login}/plugins > lines > ${handle}: @${contributor.author?.login} +${added} -${deleted} ~${changed}`)
repos[handle].added += added
repos[handle].deleted += deleted
repos[handle].changed += changed
Expand Down
Loading