snippet_slug stringlengths 97 241 | task_slug stringlengths 81 225 | domain stringclasses 40
values | context stringclasses 13
values | description stringlengths 82 228 | lang stringclasses 4
values | code stringlengths 110 4.47k | line_count int64 5 80 | unclear_naming bool 2
classes | noise_comments bool 2
classes | dead_code bool 2
classes | inconsistent_style bool 2
classes | over_abstracted bool 2
classes | too_clever bool 2
classes | duplicated_logic bool 2
classes | error_handling_problem bool 2
classes | type_safety_hole bool 2
classes | unsafe_input bool 2
classes | primary_flaw stringclasses 11
values | quality int64 1 5 | difficulty stringclasses 3
values | uncertain_flags listlengths 0 3 | findings listlengths 0 28 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
save-a-workspace-role-s-access-hours-from-a-server-action-requiring-an-administrator-and-valid-opening-and-closing-hours-then-refresh-the-role-page-ts-9e4e8c02b60b | save-a-workspace-role-s-access-hours-from-a-server-action-requiring-an-administrator-and-valid-opening-and-closing-hours-then-refresh-the-role-page | permissions | server-action | Save a workspace role's access hours from a server action, requiring an administrator and valid opening and closing hours, then refresh the role page. | ts | "use server";
import { z } from "zod";
import { revalidatePath } from "next/cache";
import { requireWorkspaceAdmin } from "./authorization";
import { roles } from "./role-repository";
const accessHoursSchema = z.object({
roleId: z.string().uuid(),
opens: z.coerce.number().int().min(0).max(23),
closes: z.coerce.n... | 32 | false | false | false | false | false | true | false | false | true | false | type_safety_hole | 3 | subtle | [] | [
{
"finding_slug": "type-safety-hole-9e4e8c02b60b-l22-l22-3197cf64",
"flag": "type_safety_hole",
"start_line": 22,
"end_line": 22,
"excerpt": " const administrator = (await requireWorkspaceAdmin())!;",
"explanation": "A non null assertion is applied to the administrator result without a chec... |
save-a-workspace-role-s-access-hours-from-a-server-action-requiring-an-administrator-and-valid-opening-and-closing-hours-then-refresh-the-role-page-ts-96e6965c3c03 | save-a-workspace-role-s-access-hours-from-a-server-action-requiring-an-administrator-and-valid-opening-and-closing-hours-then-refresh-the-role-page | permissions | server-action | Save a workspace role's access hours from a server action, requiring an administrator and valid opening and closing hours, then refresh the role page. | ts | "use server";
import { z } from "zod";
import { revalidatePath } from "next/cache";
import { requireWorkspaceAdmin } from "./authorization";
import { roles } from "./role-repository";
const accessHoursSchema = z.object({
roleId: z.string().uuid(),
opens: z.coerce.number().int().min(0).max(23),
closes: z.coerce.n... | 34 | false | true | false | true | false | false | false | false | false | false | noise_comments | 3 | subtle | [] | [
{
"finding_slug": "noise-comments-96e6965c3c03-l13-l13-6ba7488a",
"flag": "noise_comments",
"start_line": 13,
"end_line": 13,
"excerpt": "// Read one access hour from the form.",
"explanation": "A comment restates the helper name.",
"audit_verdict": "valid"
},
{
"finding_slug": "... |
save-a-workspace-role-s-access-hours-from-a-server-action-requiring-an-administrator-and-valid-opening-and-closing-hours-then-refresh-the-role-page-ts-127ecba4d3d0 | save-a-workspace-role-s-access-hours-from-a-server-action-requiring-an-administrator-and-valid-opening-and-closing-hours-then-refresh-the-role-page | permissions | server-action | Save a workspace role's access hours from a server action, requiring an administrator and valid opening and closing hours, then refresh the role page. | ts | "use server";
import { z } from "zod";
import { revalidatePath } from "next/cache";
import { requireWorkspaceAdmin } from "./authorization";
import { roles } from "./role-repository";
const accessHoursSchema = z.object({
roleId: z.string().uuid(),
opens: z.coerce.number().int().min(0).max(23),
closes: z.coerce.n... | 33 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
save-a-workspace-role-s-access-hours-from-a-server-action-requiring-an-administrator-and-valid-opening-and-closing-hours-then-refresh-the-role-page-ts-4570d59e8dc7 | save-a-workspace-role-s-access-hours-from-a-server-action-requiring-an-administrator-and-valid-opening-and-closing-hours-then-refresh-the-role-page | permissions | server-action | Save a workspace role's access hours from a server action, requiring an administrator and valid opening and closing hours, then refresh the role page. | ts | "use server";
import { z } from "zod";
import { revalidatePath } from "next/cache";
import { requireWorkspaceAdmin } from "./authorization";
import { roles } from "./role-repository";
const accessHoursSchema = z.object({
roleId: z.string().uuid(),
opens: z.coerce.number().int().min(0).max(23),
closes: z.coerce.n... | 32 | true | false | false | false | false | true | true | false | false | false | duplicated_logic | 2 | obvious | [] | [
{
"finding_slug": "unclear-naming-4570d59e8dc7-l15-l15-092fbb58",
"flag": "unclear_naming",
"start_line": 15,
"end_line": 15,
"excerpt": " const temp = form.get(\"opens\");",
"explanation": "The variable temp does not say that it holds the opening hour.",
"audit_verdict": "valid"
},
... |
read-an-email-campaign-s-daily-sent-and-bounced-counts-from-postgres-and-return-both-date-ordered-series-for-a-delivery-chart-ts-02bd047b85a7 | read-an-email-campaign-s-daily-sent-and-bounced-counts-from-postgres-and-return-both-date-ordered-series-for-a-delivery-chart | email-campaigns | database-access | Read an email campaign's daily sent and bounced counts from Postgres and return both date-ordered series for a delivery chart. | ts | import { Pool } from 'pg';
import { z } from 'zod';
const dailyCountSchema = z.object({
day: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
count: z.number().int().nonnegative()
});
type DailyCount = z.infer<typeof dailyCountSchema>;
type DeliverySeries = { sent: DailyCount[]; bounced: DailyCount[] };
export class ... | 35 | false | false | false | false | false | true | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "too-clever-02bd047b85a7-l24-l25-b239cfa2",
"flag": "too_clever",
"start_line": 24,
"end_line": 25,
"excerpt": " series.sent = rows.reduce<DailyCount[]>((counts, row) =>",
"explanation": "A reduce with a comma expression only copies rows into an array.",
"audit_v... |
read-an-email-campaign-s-daily-sent-and-bounced-counts-from-postgres-and-return-both-date-ordered-series-for-a-delivery-chart-ts-de251697548d | read-an-email-campaign-s-daily-sent-and-bounced-counts-from-postgres-and-return-both-date-ordered-series-for-a-delivery-chart | email-campaigns | database-access | Read an email campaign's daily sent and bounced counts from Postgres and return both date-ordered series for a delivery chart. | ts | import { Pool } from 'pg';
import { z } from 'zod';
const dailyCountSchema = z.object({
day: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
count: z.number().int().nonnegative()
});
type DailyCount = z.infer<typeof dailyCountSchema>;
type DeliverySeries = { sent: DailyCount[]; bounced: DailyCount[] };
export class ... | 32 | false | false | false | false | false | false | false | true | false | false | error_handling_problem | 2 | subtle | [] | [
{
"finding_slug": "error-handling-problem-de251697548d-l23-l23-cf7eb953",
"flag": "error_handling_problem",
"start_line": 23,
"end_line": 23,
"excerpt": " ).catch(() => ({ rows: [] }));",
"explanation": "A failed query is turned into an empty result so database errors look like da... |
read-an-email-campaign-s-daily-sent-and-bounced-counts-from-postgres-and-return-both-date-ordered-series-for-a-delivery-chart-ts-cefaaa1356b2 | read-an-email-campaign-s-daily-sent-and-bounced-counts-from-postgres-and-return-both-date-ordered-series-for-a-delivery-chart | email-campaigns | database-access | Read an email campaign's daily sent and bounced counts from Postgres and return both date-ordered series for a delivery chart. | ts | import { Pool } from 'pg';
import { z } from 'zod';
const dailyCountSchema = z.object({
day: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
count: z.number().int().nonnegative()
});
type DailyCount = z.infer<typeof dailyCountSchema>;
type DeliverySeries = { sent: DailyCount[]; bounced: DailyCount[] };
export class ... | 32 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
read-an-email-campaign-s-daily-sent-and-bounced-counts-from-postgres-and-return-both-date-ordered-series-for-a-delivery-chart-ts-626449731172 | read-an-email-campaign-s-daily-sent-and-bounced-counts-from-postgres-and-return-both-date-ordered-series-for-a-delivery-chart | email-campaigns | database-access | Read an email campaign's daily sent and bounced counts from Postgres and return both date-ordered series for a delivery chart. | ts | import { Pool } from 'pg';
import { z } from 'zod';
const dailyCountSchema = z.object({
day: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
count: z.number().int().nonnegative()
});
type DailyCount = z.infer<typeof dailyCountSchema>;
type DeliverySeries = { sent: DailyCount[]; bounced: DailyCount[] };
export class ... | 39 | false | false | false | true | false | false | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "inconsistent-style-626449731172-l28-l28-3c99853d",
"flag": "inconsistent_style",
"start_line": 28,
"end_line": 28,
"excerpt": " const bounce_result = await this.database.query(",
"explanation": "The bounce_result name uses snake_case while the other names use camelC... |
send-a-daily-summary-of-completed-and-declined-signing-envelopes-to-the-workspace-owner-listing-each-envelope-s-title-and-completion-or-decline-time-ts-3bcadf483d34 | send-a-daily-summary-of-completed-and-declined-signing-envelopes-to-the-workspace-owner-listing-each-envelope-s-title-and-completion-or-decline-time | document-signing | async-job | Send a daily summary of completed and declined signing envelopes to the workspace owner, listing each envelope's title and completion or decline time. | ts | import { z } from "zod";
import { signingReports, mailer } from "./signing-services";
const envelopeSchema = z.object({
id: z.string().uuid(),
title: z.string().min(1),
actedAt: z.string().datetime()
});
const reportSchema = z.object({
ownerEmail: z.string().email(),
completed: z.array(envelopeSche... | 41 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
send-a-daily-summary-of-completed-and-declined-signing-envelopes-to-the-workspace-owner-listing-each-envelope-s-title-and-completion-or-decline-time-ts-18e2e6b19af6 | send-a-daily-summary-of-completed-and-declined-signing-envelopes-to-the-workspace-owner-listing-each-envelope-s-title-and-completion-or-decline-time | document-signing | async-job | Send a daily summary of completed and declined signing envelopes to the workspace owner, listing each envelope's title and completion or decline time. | ts | import { z } from "zod";
import { signingReports, mailer } from "./signing-services";
const envelopeSchema = z.object({
id: z.string().uuid(),
title: z.string().min(1),
actedAt: z.string().datetime()
});
const reportSchema = z.object({
ownerEmail: z.string().email(),
completed: z.array(envelopeSche... | 42 | true | false | false | false | false | true | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "unclear-naming-18e2e6b19af6-l26-l26-aa16fca1",
"flag": "unclear_naming",
"start_line": 26,
"end_line": 26,
"excerpt": " const temp: string[] = [];",
"explanation": "The variable temp does not say that it holds the email sections.",
"audit_verdict": "valid"
},
{
... |
send-a-daily-summary-of-completed-and-declined-signing-envelopes-to-the-workspace-owner-listing-each-envelope-s-title-and-completion-or-decline-time-ts-394a212c8308 | send-a-daily-summary-of-completed-and-declined-signing-envelopes-to-the-workspace-owner-listing-each-envelope-s-title-and-completion-or-decline-time | document-signing | async-job | Send a daily summary of completed and declined signing envelopes to the workspace owner, listing each envelope's title and completion or decline time. | ts | import { z } from "zod";
import { signingReports, mailer } from "./signing-services";
const envelopeSchema = z.object({
id: z.string().uuid(),
title: z.string().min(1),
actedAt: z.string().datetime()
});
const reportSchema = z.object({
ownerEmail: z.string().email(),
completed: z.array(envelopeSche... | 45 | false | false | false | false | true | false | false | false | false | false | over_abstracted | 4 | subtle | [] | [
{
"finding_slug": "over-abstracted-394a212c8308-l15-l17-d2f555ff",
"flag": "over_abstracted",
"start_line": 15,
"end_line": 17,
"excerpt": "export async function sendSigningSummary(workspaceId: string, day: string): Promise<number> {",
"explanation": "The sendSigningSummary function only for... |
send-a-daily-summary-of-completed-and-declined-signing-envelopes-to-the-workspace-owner-listing-each-envelope-s-title-and-completion-or-decline-time-ts-0a94f1c29358 | send-a-daily-summary-of-completed-and-declined-signing-envelopes-to-the-workspace-owner-listing-each-envelope-s-title-and-completion-or-decline-time | document-signing | async-job | Send a daily summary of completed and declined signing envelopes to the workspace owner, listing each envelope's title and completion or decline time. | ts | import { z } from "zod";
import { signingReports, mailer } from "./signing-services";
const envelopeSchema = z.object({
id: z.string().uuid(),
title: z.string().min(1),
actedAt: z.string().datetime()
});
const reportSchema = z.object({
ownerEmail: z.string().email(),
completed: z.array(envelopeSche... | 41 | false | false | false | true | false | false | false | false | false | false | inconsistent_style | 4 | subtle | [] | [
{
"finding_slug": "inconsistent-style-0a94f1c29358-l27-l27-fee8c2d7",
"flag": "inconsistent_style",
"start_line": 27,
"end_line": 27,
"excerpt": " let envelope_count = 0;",
"explanation": "The envelope_count name uses snake_case while the other names use camelCase.",
"audit_verdict": ... |
define-promotion-audience-segments-from-marketing-json-resolve-whether-a-shopper-s-region-and-membership-tier-match-each-segment-and-produce-html-badge-labels-ts-910f7f6258e9 | define-promotion-audience-segments-from-marketing-json-resolve-whether-a-shopper-s-region-and-membership-tier-match-each-segment-and-produce-html-badge-labels | promotions | type-definitions | Define promotion audience segments from marketing JSON, resolve whether a shopper's region and membership tier match each segment, and produce HTML badge labels. | ts | import { z } from 'zod'
import escapeHtml from 'escape-html'
export type Membership = 'guest' | 'member' | 'premium'
export type AudienceSegment = {
code: string
regions: string[]
memberships: Membership[]
excludedCustomers: string[]
}
export type Shopper = {
customerId: string
region: string
membershi... | 58 | false | false | false | false | false | true | true | false | false | false | too_clever | 2 | obvious | [] | [
{
"finding_slug": "too-clever-910f7f6258e9-l39-l39-a5cdb32e",
"flag": "too_clever",
"start_line": 39,
"end_line": 39,
"excerpt": " const reason = segment.excludedCustomers.includes(shopper.customerId) ? 'excluded' : segment.regions.length && !segment.regions.includes(shopper.region) ? 'region' ... |
define-promotion-audience-segments-from-marketing-json-resolve-whether-a-shopper-s-region-and-membership-tier-match-each-segment-and-produce-html-badge-labels-ts-0e5d57480da5 | define-promotion-audience-segments-from-marketing-json-resolve-whether-a-shopper-s-region-and-membership-tier-match-each-segment-and-produce-html-badge-labels | promotions | type-definitions | Define promotion audience segments from marketing JSON, resolve whether a shopper's region and membership tier match each segment, and produce HTML badge labels. | ts | import { z } from 'zod'
import escapeHtml from 'escape-html'
export type Membership = 'guest' | 'member' | 'premium'
export type AudienceSegment = {
code: string
regions: string[]
memberships: Membership[]
excludedCustomers: string[]
}
export type Shopper = {
customerId: string
region: string
membershi... | 57 | false | false | false | true | false | false | false | false | false | false | inconsistent_style | 4 | subtle | [] | [
{
"finding_slug": "inconsistent-style-0e5d57480da5-l55-l55-261498d7",
"flag": "inconsistent_style",
"start_line": 55,
"end_line": 55,
"excerpt": " const audience_matches = resolveAudience(segments, shopper)",
"explanation": "The local name audience_matches uses snake_case while the rest of ... |
define-promotion-audience-segments-from-marketing-json-resolve-whether-a-shopper-s-region-and-membership-tier-match-each-segment-and-produce-html-badge-labels-ts-dc5b58ebc4cb | define-promotion-audience-segments-from-marketing-json-resolve-whether-a-shopper-s-region-and-membership-tier-match-each-segment-and-produce-html-badge-labels | promotions | type-definitions | Define promotion audience segments from marketing JSON, resolve whether a shopper's region and membership tier match each segment, and produce HTML badge labels. | ts | import { z } from 'zod'
import escapeHtml from 'escape-html'
export type Membership = 'guest' | 'member' | 'premium'
export type AudienceSegment = {
code: string
regions: string[]
memberships: Membership[]
excludedCustomers: string[]
}
export type Shopper = {
customerId: string
region: string
membershi... | 58 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
define-promotion-audience-segments-from-marketing-json-resolve-whether-a-shopper-s-region-and-membership-tier-match-each-segment-and-produce-html-badge-labels-ts-0df7fb37b312 | define-promotion-audience-segments-from-marketing-json-resolve-whether-a-shopper-s-region-and-membership-tier-match-each-segment-and-produce-html-badge-labels | promotions | type-definitions | Define promotion audience segments from marketing JSON, resolve whether a shopper's region and membership tier match each segment, and produce HTML badge labels. | ts | import { z } from 'zod'
export type Membership = 'guest' | 'member' | 'premium'
export type AudienceSegment = {
code: string
regions: string[]
memberships: Membership[]
excludedCustomers: string[]
}
export type Shopper = {
customerId: string
region: string
membership: Membership
}
export type Audience... | 59 | false | true | false | false | false | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "noise-comments-0df7fb37b312-l34-l34-1f18fa7f",
"flag": "noise_comments",
"start_line": 34,
"end_line": 34,
"excerpt": " // Marketing owns the segment identifiers and region values.",
"explanation": "This comment restates ownership context that the code does not need.",
... |
read-a-room-booking-export-and-print-the-total-reserved-minutes-per-room-for-confirmed-bookings-with-rooms-ordered-by-name-js-a80bdcce16bb | read-a-room-booking-export-and-print-the-total-reserved-minutes-per-room-for-confirmed-bookings-with-rooms-ordered-by-name | scheduling | cli-script | Read a room booking export and print the total reserved minutes per room for confirmed bookings, with rooms ordered by name. | js | import { readFile } from 'node:fs/promises';
import { pathToFileURL } from 'node:url';
function bookingMinutes(booking) {
const startsAt = Date.parse(booking.startsAt);
const endsAt = Date.parse(booking.endsAt);
if (!Number.isFinite(startsAt) || !Number.isFinite(endsAt) || endsAt <= startsAt) {
throw new Error('I... | 56 | false | false | true | false | false | false | true | false | true | false | type_safety_hole | 2 | subtle | [] | [
{
"finding_slug": "type-safety-hole-a80bdcce16bb-l32-l32-62ee7fe5",
"flag": "type_safety_hole",
"start_line": 32,
"end_line": 32,
"excerpt": "\t\tif (booking.confirmed != true && booking.confirmed != false) {",
"explanation": "Loose equality against true and false lets non-boolean values suc... |
read-a-room-booking-export-and-print-the-total-reserved-minutes-per-room-for-confirmed-bookings-with-rooms-ordered-by-name-js-0bdd19a408d2 | read-a-room-booking-export-and-print-the-total-reserved-minutes-per-room-for-confirmed-bookings-with-rooms-ordered-by-name | scheduling | cli-script | Read a room booking export and print the total reserved minutes per room for confirmed bookings, with rooms ordered by name. | js | import { readFile } from 'node:fs/promises';
import { pathToFileURL } from 'node:url';
function bookingMinutes(booking) {
const startsAt = Date.parse(booking.startsAt);
const endsAt = Date.parse(booking.endsAt);
if (!Number.isFinite(startsAt) || !Number.isFinite(endsAt) || endsAt <= startsAt) {
throw new Error('I... | 52 | false | false | false | false | false | true | true | false | false | false | too_clever | 2 | subtle | [] | [
{
"finding_slug": "duplicated-logic-0bdd19a408d2-l35-l40-4f55bb75",
"flag": "duplicated_logic",
"start_line": 35,
"end_line": 40,
"excerpt": "\t\tconst startsAt = Date.parse(booking.startsAt);",
"explanation": "The timestamp parsing, window validation and minutes calculation repeat what book... |
read-a-room-booking-export-and-print-the-total-reserved-minutes-per-room-for-confirmed-bookings-with-rooms-ordered-by-name-js-46f034da570e | read-a-room-booking-export-and-print-the-total-reserved-minutes-per-room-for-confirmed-bookings-with-rooms-ordered-by-name | scheduling | cli-script | Read a room booking export and print the total reserved minutes per room for confirmed bookings, with rooms ordered by name. | js | import { readFile } from 'node:fs/promises';
import { pathToFileURL } from 'node:url';
function bookingMinutes(booking) {
const startsAt = Date.parse(booking.startsAt);
const endsAt = Date.parse(booking.endsAt);
if (!Number.isFinite(startsAt) || !Number.isFinite(endsAt) || endsAt <= startsAt) {
throw new Error('I... | 52 | false | false | true | false | false | false | false | false | false | false | dead_code | 1 | obvious | [] | [
{
"finding_slug": "dead-code-46f034da570e-l22-l22-e2dcd97c",
"flag": "dead_code",
"start_line": 22,
"end_line": 22,
"excerpt": "\tdebugger;",
"explanation": "A leftover debugger statement halts execution when a debugger is attached.",
"audit_verdict": "valid"
},
{
"finding_slug":... |
read-a-room-booking-export-and-print-the-total-reserved-minutes-per-room-for-confirmed-bookings-with-rooms-ordered-by-name-js-150f799dd5ab | read-a-room-booking-export-and-print-the-total-reserved-minutes-per-room-for-confirmed-bookings-with-rooms-ordered-by-name | scheduling | cli-script | Read a room booking export and print the total reserved minutes per room for confirmed bookings, with rooms ordered by name. | js | import { readFile } from 'node:fs/promises';
import { pathToFileURL } from 'node:url';
function bookingMinutes(booking) {
const startsAt = Date.parse(booking.startsAt);
const endsAt = Date.parse(booking.endsAt);
if (!Number.isFinite(startsAt) || !Number.isFinite(endsAt) || endsAt <= startsAt) {
throw new Error('I... | 50 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
serve-a-hotel-s-arrival-board-for-a-validated-calendar-date-formatting-guest-names-and-separating-expected-arrivals-from-guests-already-checked-in-js-fc8d2a84b7bd | serve-a-hotel-s-arrival-board-for-a-validated-calendar-date-formatting-guest-names-and-separating-expected-arrivals-from-guests-already-checked-in | hotel-booking | http-handler | Serve a hotel's arrival board for a validated calendar date, formatting guest names and separating expected arrivals from guests already checked in. | js | export class ArrivalBoardHandler {
constructor(bookings) {
this.bookings = bookings
}
async handle(request, reply) {
const date = request.query?.date
if (typeof date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(date)) {
return reply.code(400).send({ error: 'Invalid arrival date' })
}
con... | 35 | false | true | true | false | false | false | false | false | false | false | dead_code | 3 | obvious | [] | [
{
"finding_slug": "dead-code-fc8d2a84b7bd-l16-l16-da559cca",
"flag": "dead_code",
"start_line": 16,
"end_line": 16,
"excerpt": " const arrivalCount = arrivals.length",
"explanation": "The arrivalCount variable is assigned but never used.",
"audit_verdict": "valid"
},
{
"findin... |
serve-a-hotel-s-arrival-board-for-a-validated-calendar-date-formatting-guest-names-and-separating-expected-arrivals-from-guests-already-checked-in-js-3ee39a0549b1 | serve-a-hotel-s-arrival-board-for-a-validated-calendar-date-formatting-guest-names-and-separating-expected-arrivals-from-guests-already-checked-in | hotel-booking | http-handler | Serve a hotel's arrival board for a validated calendar date, formatting guest names and separating expected arrivals from guests already checked in. | js | export class ArrivalBoardHandler {
constructor(bookings) {
this.bookings = bookings
}
async handle(request, reply) {
const date = request.query?.date
if (typeof date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(date)) {
return reply.code(400).send({ error: 'Invalid arrival date' })
}
con... | 37 | false | false | false | false | false | false | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "duplicated-logic-3ee39a0549b1-l20-l32-7e355d4e",
"flag": "duplicated_logic",
"start_line": 20,
"end_line": 32,
"excerpt": " checkedIn.push({",
"explanation": "The same guest object literal is built twice, once in each branch, with only the target array differing.",
... |
serve-a-hotel-s-arrival-board-for-a-validated-calendar-date-formatting-guest-names-and-separating-expected-arrivals-from-guests-already-checked-in-js-b7a9181b9125 | serve-a-hotel-s-arrival-board-for-a-validated-calendar-date-formatting-guest-names-and-separating-expected-arrivals-from-guests-already-checked-in | hotel-booking | http-handler | Serve a hotel's arrival board for a validated calendar date, formatting guest names and separating expected arrivals from guests already checked in. | js | export class ArrivalBoardHandler {
constructor(bookings) {
this.bookings = bookings
}
async handle(request, reply) {
const date = request.query?.date
if (typeof date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(date)) {
return reply.code(400).send({ error: 'Invalid arrival date' })
}
con... | 33 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
serve-a-hotel-s-arrival-board-for-a-validated-calendar-date-formatting-guest-names-and-separating-expected-arrivals-from-guests-already-checked-in-js-5bbe4b81eee7 | serve-a-hotel-s-arrival-board-for-a-validated-calendar-date-formatting-guest-names-and-separating-expected-arrivals-from-guests-already-checked-in | hotel-booking | http-handler | Serve a hotel's arrival board for a validated calendar date, formatting guest names and separating expected arrivals from guests already checked in. | js | export class ArrivalBoardHandler {
constructor(bookings) {
this.bookings = bookings
}
async handle(request, reply) {
const date = request.query?.date
if (typeof date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(date)) {
return reply.code(400).send({ error: 'Invalid arrival date' })
}
con... | 30 | false | true | false | false | false | true | false | false | false | false | too_clever | 3 | subtle | [] | [
{
"finding_slug": "noise-comments-5bbe4b81eee7-l25-l25-82f2a13b",
"flag": "noise_comments",
"start_line": 25,
"end_line": 25,
"excerpt": " // Place each guest on the correct side of the board.",
"explanation": "This comment restates what the next line does.",
"audit_verdict": "valid... |
allocate-a-cart-s-shipping-charge-among-seller-parcels-in-proportion-to-their-merchandise-value-assigning-rounding-cents-to-the-earliest-parcels-ts-66583b6b60c7 | allocate-a-cart-s-shipping-charge-among-seller-parcels-in-proportion-to-their-merchandise-value-assigning-rounding-cents-to-the-earliest-parcels | shopping-cart | utility | Allocate a cart's shipping charge among seller parcels in proportion to their merchandise value, assigning rounding cents to the earliest parcels. | ts | export type Parcel = { sellerId: string; merchandiseCents: number }
export type ShippingShare = { sellerId: string; shippingCents: number }
function runAllocation<T>(operation: () => T): T {
return operation()
}
export function allocateShipping(parcels: Parcel[], shippingCents: number): ShippingShare[] {
return run... | 34 | false | false | false | false | true | false | false | false | true | false | over_abstracted | 2 | subtle | [] | [
{
"finding_slug": "over-abstracted-66583b6b60c7-l4-l6-5bd4b35c",
"flag": "over_abstracted",
"start_line": 4,
"end_line": 6,
"excerpt": "function runAllocation<T>(operation: () => T): T {",
"explanation": "runAllocation only calls the function it is given and adds no behavior.",
"audit_ve... |
allocate-a-cart-s-shipping-charge-among-seller-parcels-in-proportion-to-their-merchandise-value-assigning-rounding-cents-to-the-earliest-parcels-ts-c28f3f2e04a5 | allocate-a-cart-s-shipping-charge-among-seller-parcels-in-proportion-to-their-merchandise-value-assigning-rounding-cents-to-the-earliest-parcels | shopping-cart | utility | Allocate a cart's shipping charge among seller parcels in proportion to their merchandise value, assigning rounding cents to the earliest parcels. | ts | export type Parcel = { sellerId: string; merchandiseCents: number }
export type ShippingShare = { sellerId: string; shippingCents: number }
export function allocateShipping(parcels: any[], shippingCents: number): ShippingShare[] {
if (!Number.isSafeInteger(shippingCents) || shippingCents < 0) {
throw new Error('Inv... | 28 | false | false | false | false | false | false | false | false | true | false | type_safety_hole | 2 | obvious | [] | [
{
"finding_slug": "type-safety-hole-c28f3f2e04a5-l4-l4-19fb60cd",
"flag": "type_safety_hole",
"start_line": 4,
"end_line": 4,
"excerpt": "export function allocateShipping(parcels: any[], shippingCents: number): ShippingShare[] {",
"explanation": "The parcels parameter is typed any[] even tho... |
allocate-a-cart-s-shipping-charge-among-seller-parcels-in-proportion-to-their-merchandise-value-assigning-rounding-cents-to-the-earliest-parcels-ts-c0d8b90a7ad6 | allocate-a-cart-s-shipping-charge-among-seller-parcels-in-proportion-to-their-merchandise-value-assigning-rounding-cents-to-the-earliest-parcels | shopping-cart | utility | Allocate a cart's shipping charge among seller parcels in proportion to their merchandise value, assigning rounding cents to the earliest parcels. | ts | export type Parcel = { sellerId: string; merchandiseCents: number }
export type ShippingShare = { sellerId: string; shippingCents: number }
export function allocateShipping(parcels: Parcel[], shippingCents: number): ShippingShare[] {
debugger
const parcelCount = parcels.length
if (!Number.isSafeInteger(shippingCent... | 30 | false | false | true | false | false | false | false | false | false | false | dead_code | 2 | obvious | [] | [
{
"finding_slug": "dead-code-c0d8b90a7ad6-l5-l5-e2dcd97c",
"flag": "dead_code",
"start_line": 5,
"end_line": 5,
"excerpt": "\tdebugger",
"explanation": "A leftover debugger statement halts execution when a debugger is attached.",
"audit_verdict": "valid"
},
{
"finding_slug": "dea... |
allocate-a-cart-s-shipping-charge-among-seller-parcels-in-proportion-to-their-merchandise-value-assigning-rounding-cents-to-the-earliest-parcels-ts-0c7eedbd21d8 | allocate-a-cart-s-shipping-charge-among-seller-parcels-in-proportion-to-their-merchandise-value-assigning-rounding-cents-to-the-earliest-parcels | shopping-cart | utility | Allocate a cart's shipping charge among seller parcels in proportion to their merchandise value, assigning rounding cents to the earliest parcels. | ts | export type Parcel = { sellerId: string; merchandiseCents: number }
export type ShippingShare = { sellerId: string; shippingCents: number }
export function allocateShipping(parcels: Parcel[], shippingCents: number): ShippingShare[] {
if (!Number.isSafeInteger(shippingCents) || shippingCents < 0) {
throw new Error('... | 28 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
test-that-clinic-waitlist-offers-expire-after-ten-minutes-accept-at-the-expiry-boundary-only-before-it-and-cannot-be-accepted-twice-or-by-a-different-patient-ts-9b93a8d95e90 | test-that-clinic-waitlist-offers-expire-after-ten-minutes-accept-at-the-expiry-boundary-only-before-it-and-cannot-be-accepted-twice-or-by-a-different-patient | clinic-appointments | test | Test that clinic waitlist offers expire after ten minutes, accept at the expiry boundary only before it, and cannot be accepted twice or by a different patient. | ts | import { describe, expect, it } from "vitest";
import { acceptOffer } from "../waitlist/offers";
const issuedAt = new Date("2026-04-07T09:00:00Z");
const expiresAt = new Date("2026-04-07T09:10:00Z");
function openOffer() {
return {
id: "offer-214",
patientId: "patient-58",
appointmentId: "slot-92",
... | 47 | false | false | false | false | false | false | false | false | false | false | none | 5 | obvious | [] | [] |
test-that-clinic-waitlist-offers-expire-after-ten-minutes-accept-at-the-expiry-boundary-only-before-it-and-cannot-be-accepted-twice-or-by-a-different-patient-ts-a458ce3d552f | test-that-clinic-waitlist-offers-expire-after-ten-minutes-accept-at-the-expiry-boundary-only-before-it-and-cannot-be-accepted-twice-or-by-a-different-patient | clinic-appointments | test | Test that clinic waitlist offers expire after ten minutes, accept at the expiry boundary only before it, and cannot be accepted twice or by a different patient. | ts | import { describe, expect, it } from "vitest";
import { acceptOffer } from "../waitlist/offers";
const issuedAt = new Date("2026-04-07T09:00:00Z");
var expires_at = new Date('2026-04-07T09:10:00Z')
function openOffer() {
return {
id: "offer-214",
patientId: "patient-58",
appointmentId: "slot-92",
st... | 47 | false | false | false | true | false | false | false | false | false | false | inconsistent_style | 2 | obvious | [] | [
{
"finding_slug": "inconsistent-style-a458ce3d552f-l5-l5-440fa203",
"flag": "inconsistent_style",
"start_line": 5,
"end_line": 5,
"excerpt": "var expires_at = new Date('2026-04-07T09:10:00Z')",
"explanation": "This line uses var, snake_case, single quotes and no semicolon while the rest of t... |
test-that-clinic-waitlist-offers-expire-after-ten-minutes-accept-at-the-expiry-boundary-only-before-it-and-cannot-be-accepted-twice-or-by-a-different-patient-ts-735901d9be45 | test-that-clinic-waitlist-offers-expire-after-ten-minutes-accept-at-the-expiry-boundary-only-before-it-and-cannot-be-accepted-twice-or-by-a-different-patient | clinic-appointments | test | Test that clinic waitlist offers expire after ten minutes, accept at the expiry boundary only before it, and cannot be accepted twice or by a different patient. | ts | import { describe, expect, it } from "vitest";
import { acceptOffer } from "../waitlist/offers";
const issuedAt = new Date("2026-04-07T09:00:00Z");
const expiresAt = new Date("2026-04-07T09:10:00Z");
function openOffer() {
return {
id: "offer-214",
patientId: "patient-58",
appointmentId: "slot-92",
... | 51 | false | false | false | false | true | false | false | false | false | false | over_abstracted | 3 | borderline | [
"over_abstracted"
] | [
{
"finding_slug": "over-abstracted-735901d9be45-l18-l20-0baf7895",
"flag": "over_abstracted",
"start_line": 18,
"end_line": 20,
"excerpt": "function offerSuite(title: string, cases: () => void) {",
"explanation": "offerSuite only forwards its arguments to describe and adds no behavior.",
... |
test-that-clinic-waitlist-offers-expire-after-ten-minutes-accept-at-the-expiry-boundary-only-before-it-and-cannot-be-accepted-twice-or-by-a-different-patient-ts-f1a87defbd64 | test-that-clinic-waitlist-offers-expire-after-ten-minutes-accept-at-the-expiry-boundary-only-before-it-and-cannot-be-accepted-twice-or-by-a-different-patient | clinic-appointments | test | Test that clinic waitlist offers expire after ten minutes, accept at the expiry boundary only before it, and cannot be accepted twice or by a different patient. | ts | import { describe, expect, it } from "vitest";
import { acceptOffer } from "../waitlist/offers";
const issuedAt = new Date("2026-04-07T09:00:00Z");
const expiresAt = new Date("2026-04-07T09:10:00Z");
function openOffer() {
return {
id: "offer-214",
patientId: "patient-58",
appointmentId: "slot-92",
... | 48 | false | true | false | false | false | false | false | false | false | false | noise_comments | 4 | obvious | [] | [
{
"finding_slug": "noise-comments-f1a87defbd64-l29-l29-64b4009a",
"flag": "noise_comments",
"start_line": 29,
"end_line": 29,
"excerpt": " // The offer window excludes its end timestamp.",
"explanation": "This comment restates what the expired assertion already shows.",
"audit_verdict... |
import-order-packing-weights-from-a-json-file-reject-invalid-kilogram-values-update-only-orders-ready-to-ship-and-print-updated-and-skipped-counts-js-b5338416fa0d | import-order-packing-weights-from-a-json-file-reject-invalid-kilogram-values-update-only-orders-ready-to-ship-and-print-updated-and-skipped-counts | order-management | cli-script | Import order packing weights from a JSON file, reject invalid kilogram values, update only orders ready to ship, and print updated and skipped counts. | js | import { readFile } from "node:fs/promises";
import { pathToFileURL } from "node:url";
import { z } from "zod";
import { orders } from "../storage/orders.js";
const packingSchema = z.array(z.object({
orderNumber: z.string().regex(/^ORD-\d{6}$/),
weightKg: z.number().finite().positive().max(1000)
}));
export c... | 53 | true | false | false | true | false | false | false | false | false | false | unclear_naming | 2 | obvious | [] | [
{
"finding_slug": "unclear-naming-b5338416fa0d-l21-l21-f7ea4bc1",
"flag": "unclear_naming",
"start_line": 21,
"end_line": 21,
"excerpt": " const x = await readFile(filename, \"utf8\");",
"explanation": "The name x does not say it holds the raw file text.",
"audit_verdict": "valid"... |
import-order-packing-weights-from-a-json-file-reject-invalid-kilogram-values-update-only-orders-ready-to-ship-and-print-updated-and-skipped-counts-js-29150e87703f | import-order-packing-weights-from-a-json-file-reject-invalid-kilogram-values-update-only-orders-ready-to-ship-and-print-updated-and-skipped-counts | order-management | cli-script | Import order packing weights from a JSON file, reject invalid kilogram values, update only orders ready to ship, and print updated and skipped counts. | js | import { readFile } from "node:fs/promises";
import { pathToFileURL } from "node:url";
import { z } from "zod";
import { orders } from "../storage/orders.js";
const packingSchema = z.array(z.object({
orderNumber: z.string().regex(/^ORD-\d{6}$/),
weightKg: z.number().finite().positive().max(1000)
}));
export c... | 53 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
import-order-packing-weights-from-a-json-file-reject-invalid-kilogram-values-update-only-orders-ready-to-ship-and-print-updated-and-skipped-counts-js-36f503a704e0 | import-order-packing-weights-from-a-json-file-reject-invalid-kilogram-values-update-only-orders-ready-to-ship-and-print-updated-and-skipped-counts | order-management | cli-script | Import order packing weights from a JSON file, reject invalid kilogram values, update only orders ready to ship, and print updated and skipped counts. | js | import { readFile } from "node:fs/promises";
import { pathToFileURL } from "node:url";
import { z } from "zod";
import { orders } from "../storage/orders.js";
const packingSchema = z.array(z.object({
orderNumber: z.string().regex(/^ORD-\d{6}$/),
weightKg: z.number().finite().positive().max(1000)
}));
export c... | 53 | true | false | false | false | false | false | false | false | false | false | unclear_naming | 4 | subtle | [] | [
{
"finding_slug": "unclear-naming-36f503a704e0-l34-l34-fe5a6726",
"flag": "unclear_naming",
"start_line": 34,
"end_line": 34,
"excerpt": " const data = await this.repository.findByNumber(record.orderNumber);",
"explanation": "The generic name data does not say it holds an order.",... |
import-order-packing-weights-from-a-json-file-reject-invalid-kilogram-values-update-only-orders-ready-to-ship-and-print-updated-and-skipped-counts-js-ffd06bc226db | import-order-packing-weights-from-a-json-file-reject-invalid-kilogram-values-update-only-orders-ready-to-ship-and-print-updated-and-skipped-counts | order-management | cli-script | Import order packing weights from a JSON file, reject invalid kilogram values, update only orders ready to ship, and print updated and skipped counts. | js | import { readFile } from "node:fs/promises";
import { pathToFileURL } from "node:url";
import { z } from "zod";
import { orders } from "../storage/orders.js";
const packingSchema = z.array(z.object({
orderNumber: z.string().regex(/^ORD-\d{6}$/),
weightKg: z.number().finite().positive().max(1000)
}));
export c... | 55 | true | false | true | false | false | false | false | false | true | false | dead_code | 1 | obvious | [] | [
{
"finding_slug": "unclear-naming-ffd06bc226db-l21-l21-f7ea4bc1",
"flag": "unclear_naming",
"start_line": 21,
"end_line": 21,
"excerpt": " const x = await readFile(filename, \"utf8\");",
"explanation": "The name x does not say it holds the raw file text.",
"audit_verdict": "valid"... |
handle-a-billing-administrator-s-request-to-replace-a-subscription-s-po-reference-refusing-cancelled-subscriptions-and-returning-the-saved-reference-js-b8dc9677c5a0 | handle-a-billing-administrator-s-request-to-replace-a-subscription-s-po-reference-refusing-cancelled-subscriptions-and-returning-the-saved-reference | subscription-billing | http-handler | Handle a billing administrator's request to replace a subscription's PO reference, refusing cancelled subscriptions and returning the saved reference. | js | import { z } from 'zod';
const referenceSchema = z.object({
purchaseOrder: z.string().trim().regex(/^[A-Z0-9-]{1,40}$/)
});
export class PurchaseOrderHandler {
constructor(subscriptions) {
this.subscriptions = subscriptions;
this.writers = { reference: (id, reference) => subscriptions.setPurch... | 33 | false | false | false | false | true | true | false | false | false | false | too_clever | 2 | subtle | [] | [
{
"finding_slug": "over-abstracted-b8dc9677c5a0-l10-l10-460e668e",
"flag": "over_abstracted",
"start_line": 10,
"end_line": 10,
"excerpt": " this.writers = { reference: (id, reference) => subscriptions.setPurchaseOrder(id, reference) };",
"explanation": "The writers map only wraps a s... |
handle-a-billing-administrator-s-request-to-replace-a-subscription-s-po-reference-refusing-cancelled-subscriptions-and-returning-the-saved-reference-js-72555fa8544f | handle-a-billing-administrator-s-request-to-replace-a-subscription-s-po-reference-refusing-cancelled-subscriptions-and-returning-the-saved-reference | subscription-billing | http-handler | Handle a billing administrator's request to replace a subscription's PO reference, refusing cancelled subscriptions and returning the saved reference. | js | import { z } from 'zod';
const referenceSchema = z.object({
purchaseOrder: z.string().trim().regex(/^[A-Z0-9-]{1,40}$/)
});
export class PurchaseOrderHandler {
constructor(subscriptions) {
this.subscriptions = subscriptions;
}
async handle(request, reply) {
if (!request.user?.roles?.i... | 35 | false | false | false | true | false | false | false | false | false | false | inconsistent_style | 4 | subtle | [] | [
{
"finding_slug": "inconsistent-style-72555fa8544f-l31-l31-747e23f3",
"flag": "inconsistent_style",
"start_line": 31,
"end_line": 31,
"excerpt": " const purchase_order = parsed.data.purchaseOrder;",
"explanation": "The local name purchase_order uses snake_case while the rest of the fi... |
handle-a-billing-administrator-s-request-to-replace-a-subscription-s-po-reference-refusing-cancelled-subscriptions-and-returning-the-saved-reference-js-4ec2ad8306d7 | handle-a-billing-administrator-s-request-to-replace-a-subscription-s-po-reference-refusing-cancelled-subscriptions-and-returning-the-saved-reference | subscription-billing | http-handler | Handle a billing administrator's request to replace a subscription's PO reference, refusing cancelled subscriptions and returning the saved reference. | js | import { z } from 'zod';
const referenceSchema = z.object({
purchaseOrder: z.string().trim().regex(/^[A-Z0-9-]{1,40}$/)
});
export class PurchaseOrderHandler {
constructor(subscriptions) {
this.subscriptions = subscriptions;
}
async handle(request, reply) {
// Check the billing admini... | 40 | false | true | true | false | false | false | true | true | true | true | error_handling_problem | 1 | obvious | [] | [
{
"finding_slug": "noise-comments-4ec2ad8306d7-l13-l13-0513b663",
"flag": "noise_comments",
"start_line": 13,
"end_line": 13,
"excerpt": " // Check the billing administrator role.",
"explanation": "This comment restates what the role check does.",
"audit_verdict": "valid"
},
{... |
handle-a-billing-administrator-s-request-to-replace-a-subscription-s-po-reference-refusing-cancelled-subscriptions-and-returning-the-saved-reference-js-f5a1f6d73e3e | handle-a-billing-administrator-s-request-to-replace-a-subscription-s-po-reference-refusing-cancelled-subscriptions-and-returning-the-saved-reference | subscription-billing | http-handler | Handle a billing administrator's request to replace a subscription's PO reference, refusing cancelled subscriptions and returning the saved reference. | js | import { z } from 'zod';
const referenceSchema = z.object({
purchaseOrder: z.string().trim().regex(/^[A-Z0-9-]{1,40}$/)
});
export class PurchaseOrderHandler {
constructor(subscriptions) {
this.subscriptions = subscriptions;
}
async handle(request, reply) {
if (!request.user?.roles?.i... | 35 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
let-an-employee-rename-the-description-of-their-unlocked-time-entry-enforce-a-120-character-limit-and-refresh-the-weekly-timesheet-page-ts-593e02174cfe | let-an-employee-rename-the-description-of-their-unlocked-time-entry-enforce-a-120-character-limit-and-refresh-the-weekly-timesheet-page | time-tracking | server-action | Let an employee rename the description of their unlocked time entry, enforce a 120-character limit, and refresh the weekly timesheet page. | ts | "use server";
import { revalidatePath } from "next/cache";
import { requireEmployee } from "../auth";
import { db } from "../db";
import { formatDuration } from "../duration";
function refreshTimesheet(path: string) {
revalidatePath(path);
}
export async function renameTimeEntry(form: FormData) {
const emplo... | 31 | false | false | true | false | true | false | false | false | false | false | dead_code | 3 | subtle | [] | [
{
"finding_slug": "dead-code-593e02174cfe-l6-l6-f98016a2",
"flag": "dead_code",
"start_line": 6,
"end_line": 6,
"excerpt": "import { formatDuration } from \"../duration\";",
"explanation": "The formatDuration import is never used.",
"audit_verdict": "valid"
},
{
"finding_slug": "... |
let-an-employee-rename-the-description-of-their-unlocked-time-entry-enforce-a-120-character-limit-and-refresh-the-weekly-timesheet-page-ts-d076e1c57a1c | let-an-employee-rename-the-description-of-their-unlocked-time-entry-enforce-a-120-character-limit-and-refresh-the-weekly-timesheet-page | time-tracking | server-action | Let an employee rename the description of their unlocked time entry, enforce a 120-character limit, and refresh the weekly timesheet page. | ts | "use server";
import { revalidatePath } from "next/cache";
import { requireEmployee } from "../auth";
import { db } from "../db";
export async function renameTimeEntry(form: FormData) {
const employee = await requireEmployee();
const entryId = form.get("entryId");
const description = form.get("description... | 29 | false | false | false | true | false | false | true | false | false | false | duplicated_logic | 2 | obvious | [] | [
{
"finding_slug": "inconsistent-style-d076e1c57a1c-l17-l17-8de084a7",
"flag": "inconsistent_style",
"start_line": 17,
"end_line": 17,
"excerpt": " const time_entry = await db.timeEntry.findFirst({ where: { id: entryId, employeeId: employee.id } });",
"explanation": "The local name time_en... |
let-an-employee-rename-the-description-of-their-unlocked-time-entry-enforce-a-120-character-limit-and-refresh-the-weekly-timesheet-page-ts-d971403b09f8 | let-an-employee-rename-the-description-of-their-unlocked-time-entry-enforce-a-120-character-limit-and-refresh-the-weekly-timesheet-page | time-tracking | server-action | Let an employee rename the description of their unlocked time entry, enforce a 120-character limit, and refresh the weekly timesheet page. | ts | "use server";
import { revalidatePath } from "next/cache";
import { requireEmployee } from "../auth";
import { db } from "../db";
export async function renameTimeEntry(form: FormData) {
const employee = await requireEmployee();
const entryId = form.get("entryId");
const description = form.get("description... | 30 | false | false | true | false | false | false | true | false | false | false | duplicated_logic | 2 | subtle | [] | [
{
"finding_slug": "dead-code-d971403b09f8-l11-l11-566ba494",
"flag": "dead_code",
"start_line": 11,
"end_line": 11,
"excerpt": " const submittedAt = new Date();",
"explanation": "The submittedAt variable is assigned but never used.",
"audit_verdict": "valid"
},
{
"finding_slug... |
let-an-employee-rename-the-description-of-their-unlocked-time-entry-enforce-a-120-character-limit-and-refresh-the-weekly-timesheet-page-ts-9cb24fd2a918 | let-an-employee-rename-the-description-of-their-unlocked-time-entry-enforce-a-120-character-limit-and-refresh-the-weekly-timesheet-page | time-tracking | server-action | Let an employee rename the description of their unlocked time entry, enforce a 120-character limit, and refresh the weekly timesheet page. | ts | "use server";
import { revalidatePath } from "next/cache";
import { requireEmployee } from "../auth";
import { db } from "../db";
export async function renameTimeEntry(form: FormData) {
const employee = await requireEmployee();
const entryId = form.get("entryId");
const description = form.get("description... | 26 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
show-an-invoice-dispute-panel-with-a-sanitized-customer-note-a-reason-field-and-an-async-resolution-button-that-reports-submission-failures-tsx-eee0da6e51e1 | show-an-invoice-dispute-panel-with-a-sanitized-customer-note-a-reason-field-and-an-async-resolution-button-that-reports-submission-failures | invoicing | react-component | Show an invoice dispute panel with a sanitized customer note, a reason field, and an async resolution button that reports submission failures. | tsx | import { useRef, useState } from 'react';
import DOMPurify from 'dompurify';
type Props = {
invoiceNumber: string;
customerNoteHtml: string;
resolve: (reason: string) => Promise<void>;
};
export function InvoiceDispute({ invoiceNumber, customerNoteHtml, resolve }: Props) {
const reasonInput = useRef<HTMLTextA... | 52 | true | false | true | false | false | false | false | true | false | false | error_handling_problem | 1 | obvious | [] | [
{
"finding_slug": "unclear-naming-eee0da6e51e1-l13-l13-3cbd7609",
"flag": "unclear_naming",
"start_line": 13,
"end_line": 13,
"excerpt": " const [p, setP] = useState(false);",
"explanation": "The state name p does not say it tracks a pending submission.",
"audit_verdict": "valid"
},
... |
show-an-invoice-dispute-panel-with-a-sanitized-customer-note-a-reason-field-and-an-async-resolution-button-that-reports-submission-failures-tsx-abeace04c663 | show-an-invoice-dispute-panel-with-a-sanitized-customer-note-a-reason-field-and-an-async-resolution-button-that-reports-submission-failures | invoicing | react-component | Show an invoice dispute panel with a sanitized customer note, a reason field, and an async resolution button that reports submission failures. | tsx | import { useRef, useState } from 'react';
import DOMPurify from 'dompurify';
type Props = {
invoiceNumber: string;
customerNoteHtml: string;
resolve: (reason: string) => Promise<void>;
};
export function InvoiceDispute({ invoiceNumber, customerNoteHtml, resolve }: Props) {
const reasonInput = useRef<HTMLTextA... | 52 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
show-an-invoice-dispute-panel-with-a-sanitized-customer-note-a-reason-field-and-an-async-resolution-button-that-reports-submission-failures-tsx-7c61a66f0bff | show-an-invoice-dispute-panel-with-a-sanitized-customer-note-a-reason-field-and-an-async-resolution-button-that-reports-submission-failures | invoicing | react-component | Show an invoice dispute panel with a sanitized customer note, a reason field, and an async resolution button that reports submission failures. | tsx | import { useRef, useState } from 'react';
import DOMPurify from 'dompurify';
type Props = {
invoiceNumber: string;
customerNoteHtml: string;
resolve: (reason: string) => Promise<void>;
};
export function InvoiceDispute({ invoiceNumber, customerNoteHtml, resolve }: Props) {
const reasonInput = useRef<HTMLTextA... | 52 | false | false | false | false | false | false | false | false | true | false | type_safety_hole | 3 | subtle | [] | [
{
"finding_slug": "type-safety-hole-7c61a66f0bff-l20-l20-5b6adba1",
"flag": "type_safety_hole",
"start_line": 20,
"end_line": 20,
"excerpt": " reasonInput.current!.focus();",
"explanation": "The non-null assertion on the ref bypasses the null check.",
"audit_verdict": "valid"
}
] |
show-an-invoice-dispute-panel-with-a-sanitized-customer-note-a-reason-field-and-an-async-resolution-button-that-reports-submission-failures-tsx-096034c03128 | show-an-invoice-dispute-panel-with-a-sanitized-customer-note-a-reason-field-and-an-async-resolution-button-that-reports-submission-failures | invoicing | react-component | Show an invoice dispute panel with a sanitized customer note, a reason field, and an async resolution button that reports submission failures. | tsx | import { useRef, useState } from 'react';
type Props = {
invoiceNumber: string;
customerNoteHtml: string;
resolve: (reason: string) => Promise<void>;
};
export function InvoiceDispute({ invoiceNumber, customerNoteHtml, resolve }: Props) {
const reasonInput = useRef<HTMLTextAreaElement>(null);
const [reason,... | 51 | false | false | false | false | false | false | false | false | false | true | unsafe_input | 1 | subtle | [] | [
{
"finding_slug": "unsafe-input-096034c03128-l38-l38-738a0721",
"flag": "unsafe_input",
"start_line": 38,
"end_line": 38,
"excerpt": " <div dangerouslySetInnerHTML={{ __html: noteHtml }} />",
"explanation": "The customer note HTML is injected unsanitized through dangerouslySetInnerHTML.... |
transform-cms-article-and-guide-records-into-an-html-index-with-escaped-labels-validated-https-links-and-separate-lists-sorted-alphabetically-ts-ae033d468acf | transform-cms-article-and-guide-records-into-an-html-index-with-escaped-labels-validated-https-links-and-separate-lists-sorted-alphabetically | content-publishing | data-transform | Transform CMS article and guide records into an HTML index with escaped labels, validated HTTPS links, and separate lists sorted alphabetically. | ts | import { z } from 'zod';
import escapeHtml from 'escape-html';
const recordSchema = z.object({
title: z.string().min(1),
url: z.string().url().refine(value => new URL(value).protocol === 'https:'),
kind: z.enum(['article', 'guide'])
});
type IndexRecord = z.infer<typeof recordSchema>;
export class ContentIndex... | 46 | false | false | false | false | false | true | false | true | false | false | error_handling_problem | 2 | subtle | [] | [
{
"finding_slug": "error-handling-problem-ae033d468acf-l18-l20-d540f5e4",
"flag": "error_handling_problem",
"start_line": 18,
"end_line": 20,
"excerpt": " } catch {",
"explanation": "The empty catch turns invalid payloads into an empty index and loses the validation error.",
"audit_ve... |
transform-cms-article-and-guide-records-into-an-html-index-with-escaped-labels-validated-https-links-and-separate-lists-sorted-alphabetically-ts-c6ced1dd24c2 | transform-cms-article-and-guide-records-into-an-html-index-with-escaped-labels-validated-https-links-and-separate-lists-sorted-alphabetically | content-publishing | data-transform | Transform CMS article and guide records into an HTML index with escaped labels, validated HTTPS links, and separate lists sorted alphabetically. | ts | import { z } from 'zod';
import escapeHtml from 'escape-html';
const recordSchema = z.object({
title: z.string().min(1),
url: z.string().url().refine(value => new URL(value).protocol === 'https:'),
kind: z.enum(['article', 'guide'])
});
type IndexRecord = z.infer<typeof recordSchema>;
export class ContentIndex... | 46 | false | false | true | false | false | false | true | false | false | false | duplicated_logic | 2 | subtle | [] | [
{
"finding_slug": "dead-code-c6ced1dd24c2-l22-l22-e1a9acbb",
"flag": "dead_code",
"start_line": 22,
"end_line": 22,
"excerpt": " const recordCount = this.records.length;",
"explanation": "The recordCount variable is assigned but never used.",
"audit_verdict": "valid"
},
{
"fin... |
transform-cms-article-and-guide-records-into-an-html-index-with-escaped-labels-validated-https-links-and-separate-lists-sorted-alphabetically-ts-4453cfd652d0 | transform-cms-article-and-guide-records-into-an-html-index-with-escaped-labels-validated-https-links-and-separate-lists-sorted-alphabetically | content-publishing | data-transform | Transform CMS article and guide records into an HTML index with escaped labels, validated HTTPS links, and separate lists sorted alphabetically. | ts | import { z } from 'zod';
import escapeHtml from 'escape-html';
const recordSchema = z.object({
title: z.string().min(1),
url: z.string().url().refine(value => new URL(value).protocol === 'https:'),
kind: z.enum(['article', 'guide'])
});
type IndexRecord = z.infer<typeof recordSchema>;
export class ContentIndex... | 41 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
transform-cms-article-and-guide-records-into-an-html-index-with-escaped-labels-validated-https-links-and-separate-lists-sorted-alphabetically-ts-60bc2d85d58f | transform-cms-article-and-guide-records-into-an-html-index-with-escaped-labels-validated-https-links-and-separate-lists-sorted-alphabetically | content-publishing | data-transform | Transform CMS article and guide records into an HTML index with escaped labels, validated HTTPS links, and separate lists sorted alphabetically. | ts | import { z } from 'zod';
import escapeHtml from 'escape-html';
const recordSchema = z.object({
title: z.string().min(1),
url: z.string().url().refine(value => new URL(value).protocol === 'https:'),
kind: z.enum(['article', 'guide'])
});
type IndexRecord = z.infer<typeof recordSchema>;
export class ContentIndex... | 45 | false | false | false | false | false | false | true | false | false | true | unsafe_input | 1 | subtle | [] | [
{
"finding_slug": "duplicated-logic-60bc2d85d58f-l22-l35-fe51978e",
"flag": "duplicated_logic",
"start_line": 22,
"end_line": 35,
"excerpt": " const articleItems = [...articles]",
"explanation": "The sort and render steps for articles are repeated for guides with only the source list chan... |
search-a-merchant-s-product-reviews-by-text-and-minimum-star-rating-return-the-newest-twenty-matches-and-include-whether-each-reviewer-bought-the-product-ts-1a2d6837a2e8 | search-a-merchant-s-product-reviews-by-text-and-minimum-star-rating-return-the-newest-twenty-matches-and-include-whether-each-reviewer-bought-the-product | reviews | http-handler | Search a merchant's product reviews by text and minimum star rating, return the newest twenty matches, and include whether each reviewer bought the product. | ts | import { z } from 'zod'
import type { Pool } from 'pg'
import { requireMerchant } from '../auth'
const searchSchema = z.object({
term: z.string().trim().max(100),
minimumStars: z.coerce.number().int().min(1).max(5)
})
type ReviewRow = {
id: string
product_id: string
body: string
stars: number
verified_p... | 50 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
search-a-merchant-s-product-reviews-by-text-and-minimum-star-rating-return-the-newest-twenty-matches-and-include-whether-each-reviewer-bought-the-product-ts-6b9414c76c3a | search-a-merchant-s-product-reviews-by-text-and-minimum-star-rating-return-the-newest-twenty-matches-and-include-whether-each-reviewer-bought-the-product | reviews | http-handler | Search a merchant's product reviews by text and minimum star rating, return the newest twenty matches, and include whether each reviewer bought the product. | ts | import { z } from 'zod'
import type { Pool } from 'pg'
import { requireMerchant } from '../auth'
const searchSchema = z.object({
term: z.string().trim().max(100),
minimumStars: z.coerce.number().int().min(1).max(5)
})
type ReviewRow = {
id: string
product_id: string
body: string
stars: number
verified_p... | 53 | false | false | false | false | false | true | false | false | true | false | too_clever | 2 | obvious | [] | [
{
"finding_slug": "type-safety-hole-6b9414c76c3a-l40-l40-c2a444c8",
"flag": "type_safety_hole",
"start_line": 40,
"end_line": 40,
"excerpt": " const reviews = result.rows.map((row: any) => {",
"explanation": "The row parameter is typed any even though ReviewRow is available.",
"audit_... |
search-a-merchant-s-product-reviews-by-text-and-minimum-star-rating-return-the-newest-twenty-matches-and-include-whether-each-reviewer-bought-the-product-ts-d96f14b626ee | search-a-merchant-s-product-reviews-by-text-and-minimum-star-rating-return-the-newest-twenty-matches-and-include-whether-each-reviewer-bought-the-product | reviews | http-handler | Search a merchant's product reviews by text and minimum star rating, return the newest twenty matches, and include whether each reviewer bought the product. | ts | import { z } from 'zod'
import type { Pool } from 'pg'
import { requireMerchant } from '../auth'
const searchSchema = z.object({
term: z.string().trim().max(100),
minimumStars: z.coerce.number().int().min(1).max(5)
})
type ReviewRow = {
id: string
product_id: string
body: string
stars: number
verified_p... | 50 | false | false | false | false | false | false | false | false | false | true | unsafe_input | 1 | obvious | [] | [
{
"finding_slug": "unsafe-input-d96f14b626ee-l36-l36-f2e262ed",
"flag": "unsafe_input",
"start_line": 36,
"end_line": 36,
"excerpt": " WHERE merchant_id = $1 AND stars >= $2 AND position(lower('${term}') in lower(body)) > 0",
"explanation": "The search term from the query string is int... |
search-a-merchant-s-product-reviews-by-text-and-minimum-star-rating-return-the-newest-twenty-matches-and-include-whether-each-reviewer-bought-the-product-ts-175918ead22c | search-a-merchant-s-product-reviews-by-text-and-minimum-star-rating-return-the-newest-twenty-matches-and-include-whether-each-reviewer-bought-the-product | reviews | http-handler | Search a merchant's product reviews by text and minimum star rating, return the newest twenty matches, and include whether each reviewer bought the product. | ts | import { z } from 'zod'
import type { Pool } from 'pg'
import { requireMerchant } from '../auth'
const searchSchema = z.object({
term: z.string().trim().max(100),
minimumStars: z.coerce.number().int().min(1).max(5)
})
type ReviewRow = {
id: string
product_id: string
body: string
stars: number
verified_p... | 50 | false | false | false | false | false | false | false | false | true | false | type_safety_hole | 3 | obvious | [] | [
{
"finding_slug": "type-safety-hole-175918ead22c-l40-l40-c2a444c8",
"flag": "type_safety_hole",
"start_line": 40,
"end_line": 40,
"excerpt": " const reviews = result.rows.map((row: any) => ({",
"explanation": "The row parameter is typed any even though ReviewRow is available.",
"audit... |
allow-a-course-instructor-to-change-the-pass-mark-of-an-unpublished-quiz-rejecting-percentages-outside-1-to-100-and-refreshing-the-course-editor-js-d48aa694ba80 | allow-a-course-instructor-to-change-the-pass-mark-of-an-unpublished-quiz-rejecting-percentages-outside-1-to-100-and-refreshing-the-course-editor | course-management | server-action | Allow a course instructor to change the pass mark of an unpublished quiz, rejecting percentages outside 1 to 100 and refreshing the course editor. | js | "use server";
const { requireInstructor } = require("../auth");
const { db } = require("../database");
const { revalidatePath } = require("next/cache");
async function updatePassMark(form) {
const instructor = await requireInstructor();
const quizId = form.get("quizId");
const passMarkText = form.get("pas... | 30 | false | false | true | false | false | false | false | false | false | false | dead_code | 4 | subtle | [] | [
{
"finding_slug": "dead-code-d48aa694ba80-l24-l24-a1692586",
"flag": "dead_code",
"start_line": 24,
"end_line": 24,
"excerpt": " const earlierPassMark = quiz.passMark;",
"explanation": "The earlierPassMark variable is assigned but never used.",
"audit_verdict": "valid"
}
] |
allow-a-course-instructor-to-change-the-pass-mark-of-an-unpublished-quiz-rejecting-percentages-outside-1-to-100-and-refreshing-the-course-editor-js-47f69a2f7df5 | allow-a-course-instructor-to-change-the-pass-mark-of-an-unpublished-quiz-rejecting-percentages-outside-1-to-100-and-refreshing-the-course-editor | course-management | server-action | Allow a course instructor to change the pass mark of an unpublished quiz, rejecting percentages outside 1 to 100 and refreshing the course editor. | js | "use server";
const { requireInstructor } = require("../auth");
const { db } = require("../database");
const { revalidatePath } = require("next/cache");
async function updatePassMark(form) {
const instructor = await requireInstructor();
const quizId = form.get("quizId");
const data = form.get("passMark");... | 29 | true | false | false | false | false | false | false | false | false | false | unclear_naming | 4 | subtle | [] | [
{
"finding_slug": "unclear-naming-47f69a2f7df5-l10-l10-80bad48a",
"flag": "unclear_naming",
"start_line": 10,
"end_line": 10,
"excerpt": " const data = form.get(\"passMark\");",
"explanation": "The generic name data does not say it holds the raw pass mark text.",
"audit_verdict": "val... |
allow-a-course-instructor-to-change-the-pass-mark-of-an-unpublished-quiz-rejecting-percentages-outside-1-to-100-and-refreshing-the-course-editor-js-648c37a13bde | allow-a-course-instructor-to-change-the-pass-mark-of-an-unpublished-quiz-rejecting-percentages-outside-1-to-100-and-refreshing-the-course-editor | course-management | server-action | Allow a course instructor to change the pass mark of an unpublished quiz, rejecting percentages outside 1 to 100 and refreshing the course editor. | js | "use server";
const { requireInstructor } = require("../auth");
const { db } = require("../database");
const { revalidatePath } = require("next/cache");
async function updatePassMark(form) {
const instructor = await requireInstructor();
const quizId = form.get("quizId");
const passMarkText = form.get("pas... | 30 | false | true | false | false | false | false | false | false | false | false | noise_comments | 4 | obvious | [] | [
{
"finding_slug": "noise-comments-648c37a13bde-l23-l23-d1caa366",
"flag": "noise_comments",
"start_line": 23,
"end_line": 23,
"excerpt": " // Published quiz scores must keep their original pass mark.",
"explanation": "This comment restates the reason for the check on the next line.",
... |
allow-a-course-instructor-to-change-the-pass-mark-of-an-unpublished-quiz-rejecting-percentages-outside-1-to-100-and-refreshing-the-course-editor-js-cc6aaaefc3ad | allow-a-course-instructor-to-change-the-pass-mark-of-an-unpublished-quiz-rejecting-percentages-outside-1-to-100-and-refreshing-the-course-editor | course-management | server-action | Allow a course instructor to change the pass mark of an unpublished quiz, rejecting percentages outside 1 to 100 and refreshing the course editor. | js | "use server";
const { requireInstructor } = require("../auth");
const { db } = require("../database");
const { revalidatePath } = require("next/cache");
async function updatePassMark(form) {
const instructor = await requireInstructor();
const quizId = form.get("quizId");
const passMarkText = form.get("pas... | 29 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
test-that-a-supplier-quote-fixture-s-html-preview-escapes-supplier-names-and-line-descriptions-while-preserving-the-quote-number-heading-js-16fcb23ca31d | test-that-a-supplier-quote-fixture-s-html-preview-escapes-supplier-names-and-line-descriptions-while-preserving-the-quote-number-heading | procurement | test | Test that a supplier quote fixture's HTML preview escapes supplier names and line descriptions while preserving the quote number heading. | js | import { expect, test } from "vitest";
import { readFile } from "node:fs/promises";
import { z } from "zod";
import { renderQuote } from "../quotes/render.js";
test("quote preview escapes supplier text", async () => {
const fixture = JSON.parse(await readFile(new URL("./fixtures/quote.json", import.meta.url), "utf8"... | 17 | false | false | false | false | false | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "unsafe-input-16fcb23ca31d-l13-l13-227448b7",
"flag": "unsafe_input",
"start_line": 13,
"end_line": 13,
"excerpt": " document.body.innerHTML = html + quote.footerHtml;",
"explanation": "The footer HTML from the fixture is assigned to innerHTML without sanitizing it.",
... |
test-that-a-supplier-quote-fixture-s-html-preview-escapes-supplier-names-and-line-descriptions-while-preserving-the-quote-number-heading-js-5b56c7edc769 | test-that-a-supplier-quote-fixture-s-html-preview-escapes-supplier-names-and-line-descriptions-while-preserving-the-quote-number-heading | procurement | test | Test that a supplier quote fixture's HTML preview escapes supplier names and line descriptions while preserving the quote number heading. | js | import { expect, test } from "vitest";
import { readFile } from "node:fs/promises";
import { z } from "zod";
import DOMPurify from "dompurify";
import { renderQuote } from "../quotes/render.js";
test("quote preview escapes supplier text", async () => {
const fixture = JSON.parse(await readFile(new URL("./fixtures/qu... | 17 | false | false | false | false | false | true | false | false | false | false | too_clever | 2 | obvious | [] | [
{
"finding_slug": "too-clever-5b56c7edc769-l14-l16-55d52eda",
"flag": "too_clever",
"start_line": 14,
"end_line": 16,
"excerpt": " (html = renderQuote(quote), document.body.innerHTML = html + DOMPurify.sanitize(quote.footerHtml), expect(html).toContain(`<h1>${quote.number}</h1>`),",
"explan... |
test-that-a-supplier-quote-fixture-s-html-preview-escapes-supplier-names-and-line-descriptions-while-preserving-the-quote-number-heading-js-6b4179613d93 | test-that-a-supplier-quote-fixture-s-html-preview-escapes-supplier-names-and-line-descriptions-while-preserving-the-quote-number-heading | procurement | test | Test that a supplier quote fixture's HTML preview escapes supplier names and line descriptions while preserving the quote number heading. | js | import { expect, test } from "vitest";
import { readFile } from "node:fs/promises";
import { z } from "zod";
import DOMPurify from "dompurify";
import { renderQuote } from "../quotes/render.js";
test("quote preview escapes supplier text", async () => {
const fixture = JSON.parse(await readFile(new URL("./fixtures/qu... | 17 | false | false | false | true | false | true | false | false | false | false | too_clever | 2 | obvious | [] | [
{
"finding_slug": "inconsistent-style-6b4179613d93-l13-l13-c4db852b",
"flag": "inconsistent_style",
"start_line": 13,
"end_line": 13,
"excerpt": " var rendered_html = '';",
"explanation": "This line uses var, snake_case and single quotes while the rest of the file uses const, camelCase and ... |
test-that-a-supplier-quote-fixture-s-html-preview-escapes-supplier-names-and-line-descriptions-while-preserving-the-quote-number-heading-js-a348e4331fb1 | test-that-a-supplier-quote-fixture-s-html-preview-escapes-supplier-names-and-line-descriptions-while-preserving-the-quote-number-heading | procurement | test | Test that a supplier quote fixture's HTML preview escapes supplier names and line descriptions while preserving the quote number heading. | js | import { expect, test } from "vitest";
import { readFile } from "node:fs/promises";
import { z } from "zod";
import DOMPurify from "dompurify";
import { renderQuote } from "../quotes/render.js";
test("quote preview escapes supplier text", async () => {
const fixture = JSON.parse(await readFile(new URL("./fixtures/qu... | 18 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
define-invoice-settlement-splits-for-deposit-and-balance-payments-validate-whole-cent-amounts-and-derive-the-amount-still-owed-after-each-scheduled-payment-ts-9a852e44ff32 | define-invoice-settlement-splits-for-deposit-and-balance-payments-validate-whole-cent-amounts-and-derive-the-amount-still-owed-after-each-scheduled-payment | invoicing | type-definitions | Define invoice settlement splits for deposit and balance payments, validate whole-cent amounts, and derive the amount still owed after each scheduled payment. | ts | export type SettlementSplit = {
invoiceNumber: string
depositCents: number
balanceCents: number
paidCents: number
}
export type SettlementStage = 'deposit' | 'balance' | 'settled'
export type SettlementPosition = {
invoiceNumber: string
totalCents: number
remainingCents: number
stage: SettlementStage
deposit... | 63 | true | false | false | false | false | false | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "duplicated-logic-9a852e44ff32-l26-l34-09badc62",
"flag": "duplicated_logic",
"start_line": 26,
"end_line": 34,
"excerpt": "\tif (!Number.isSafeInteger(split.depositCents) || split.depositCents < 0) {",
"explanation": "The same whole-cent validation is written out three tim... |
define-invoice-settlement-splits-for-deposit-and-balance-payments-validate-whole-cent-amounts-and-derive-the-amount-still-owed-after-each-scheduled-payment-ts-2e950d498474 | define-invoice-settlement-splits-for-deposit-and-balance-payments-validate-whole-cent-amounts-and-derive-the-amount-still-owed-after-each-scheduled-payment | invoicing | type-definitions | Define invoice settlement splits for deposit and balance payments, validate whole-cent amounts, and derive the amount still owed after each scheduled payment. | ts | export type SettlementSplit = {
invoiceNumber: string
depositCents: number
balanceCents: number
paidCents: number
}
export type SettlementStage = 'deposit' | 'balance' | 'settled'
export type SettlementPosition = {
invoiceNumber: string
totalCents: number
remainingCents: number
stage: SettlementStage
deposit... | 61 | false | false | true | true | false | false | false | false | false | false | dead_code | 1 | obvious | [] | [
{
"finding_slug": "inconsistent-style-2e950d498474-l31-l31-c39fa9ed",
"flag": "inconsistent_style",
"start_line": 31,
"end_line": 31,
"excerpt": "\tvar total_cents = split.depositCents + split.balanceCents;",
"explanation": "This line uses var, snake_case and a semicolon while the rest of th... |
define-invoice-settlement-splits-for-deposit-and-balance-payments-validate-whole-cent-amounts-and-derive-the-amount-still-owed-after-each-scheduled-payment-ts-62076f52b631 | define-invoice-settlement-splits-for-deposit-and-balance-payments-validate-whole-cent-amounts-and-derive-the-amount-still-owed-after-each-scheduled-payment | invoicing | type-definitions | Define invoice settlement splits for deposit and balance payments, validate whole-cent amounts, and derive the amount still owed after each scheduled payment. | ts | export type SettlementSplit = {
invoiceNumber: string
depositCents: number
balanceCents: number
paidCents: number
}
export type SettlementStage = 'deposit' | 'balance' | 'settled'
export type SettlementPosition = {
invoiceNumber: string
totalCents: number
remainingCents: number
stage: SettlementStage
deposit... | 59 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
define-invoice-settlement-splits-for-deposit-and-balance-payments-validate-whole-cent-amounts-and-derive-the-amount-still-owed-after-each-scheduled-payment-ts-02c2215b27b5 | define-invoice-settlement-splits-for-deposit-and-balance-payments-validate-whole-cent-amounts-and-derive-the-amount-still-owed-after-each-scheduled-payment | invoicing | type-definitions | Define invoice settlement splits for deposit and balance payments, validate whole-cent amounts, and derive the amount still owed after each scheduled payment. | ts | export type SettlementSplit = {
invoiceNumber: string
depositCents: number
balanceCents: number
paidCents: number
}
export type SettlementStage = 'deposit' | 'balance' | 'settled'
export type SettlementPosition = {
invoiceNumber: string
totalCents: number
remainingCents: number
stage: SettlementStage
deposit... | 60 | false | true | false | false | false | false | false | false | false | false | noise_comments | 4 | obvious | [] | [
{
"finding_slug": "noise-comments-02c2215b27b5-l33-l33-64f0ba03",
"flag": "noise_comments",
"start_line": 33,
"end_line": 33,
"excerpt": "\t// Payments are allocated to the deposit before reducing the balance.",
"explanation": "This comment restates the allocation order the next lines alread... |
wire-expense-table-filters-for-personal-items-and-missing-receipts-display-the-visible-row-count-and-save-the-filter-choices-with-storage-errors-shown-inline-ts-3473013e0d4c | wire-expense-table-filters-for-personal-items-and-missing-receipts-display-the-visible-row-count-and-save-the-filter-choices-with-storage-errors-shown-inline | expense-reports | dom-code | Wire expense table filters for personal items and missing receipts, display the visible row count, and save the filter choices with storage errors shown inline. | ts | export function bindExpenseFilters(root: HTMLElement, storage: Storage) {
const personalToggle = root.querySelector('[name="hidePersonal"]')
const receiptToggle = root.querySelector('[name="missingReceipt"]')
const countOutput = root.querySelector('[data-visible-count]')
const errorOutput = root.querySe... | 64 | false | false | false | false | false | false | true | false | false | false | duplicated_logic | 2 | obvious | [] | [
{
"finding_slug": "duplicated-logic-3473013e0d4c-l34-l52-9928aeb9",
"flag": "duplicated_logic",
"start_line": 34,
"end_line": 52,
"excerpt": " function updateReceipts() {",
"explanation": "updateReceipts is a line-for-line copy of update.",
"audit_verdict": "valid"
}
] |
wire-expense-table-filters-for-personal-items-and-missing-receipts-display-the-visible-row-count-and-save-the-filter-choices-with-storage-errors-shown-inline-ts-d10f57cc7f63 | wire-expense-table-filters-for-personal-items-and-missing-receipts-display-the-visible-row-count-and-save-the-filter-choices-with-storage-errors-shown-inline | expense-reports | dom-code | Wire expense table filters for personal items and missing receipts, display the visible row count, and save the filter choices with storage errors shown inline. | ts | export function bindExpenseFilters(root: HTMLElement, storage: Storage) {
const personalToggle = root.querySelector('[name="hidePersonal"]')
const receiptToggle = root.querySelector('[name="missingReceipt"]')
const countOutput = root.querySelector('[data-visible-count]')
const errorOutput = root.querySe... | 44 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
wire-expense-table-filters-for-personal-items-and-missing-receipts-display-the-visible-row-count-and-save-the-filter-choices-with-storage-errors-shown-inline-ts-6da77bdbbe80 | wire-expense-table-filters-for-personal-items-and-missing-receipts-display-the-visible-row-count-and-save-the-filter-choices-with-storage-errors-shown-inline | expense-reports | dom-code | Wire expense table filters for personal items and missing receipts, display the visible row count, and save the filter choices with storage errors shown inline. | ts | export function bindExpenseFilters(root: HTMLElement, storage: Storage) {
const personalToggle = root.querySelector('[name="hidePersonal"]')
const receiptToggle = root.querySelector('[name="missingReceipt"]')
const countOutput = root.querySelector('[data-visible-count]')
const errorOutput = root.querySe... | 43 | false | true | false | false | false | true | false | false | false | false | too_clever | 2 | obvious | [] | [
{
"finding_slug": "noise-comments-6da77bdbbe80-l16-l16-1a6554ff",
"flag": "noise_comments",
"start_line": 16,
"end_line": 16,
"excerpt": " // Filter and count each expense row.",
"explanation": "This comment restates what the loop does.",
"audit_verdict": "valid"
},
{
"fin... |
wire-expense-table-filters-for-personal-items-and-missing-receipts-display-the-visible-row-count-and-save-the-filter-choices-with-storage-errors-shown-inline-ts-d5ab9ddc3c76 | wire-expense-table-filters-for-personal-items-and-missing-receipts-display-the-visible-row-count-and-save-the-filter-choices-with-storage-errors-shown-inline | expense-reports | dom-code | Wire expense table filters for personal items and missing receipts, display the visible row count, and save the filter choices with storage errors shown inline. | ts | export function bindExpenseFilters(root: HTMLElement, storage: Storage) {
const personalToggle = root.querySelector('[name="hidePersonal"]')
const receiptToggle = root.querySelector('[name="missingReceipt"]')
const countOutput = root.querySelector('[data-visible-count]')
const errorOutput = root.querySe... | 43 | false | false | false | false | false | true | false | true | false | false | error_handling_problem | 2 | subtle | [] | [
{
"finding_slug": "too-clever-d5ab9ddc3c76-l20-l20-f650ebbe",
"flag": "too_clever",
"start_line": 20,
"end_line": 20,
"excerpt": " !row.hidden && visibleCount++",
"explanation": "A short-circuit expression with a negation and an increment hides the count update.",
"audit_verdi... |
download-a-stored-csv-dispatch-manifest-for-the-signed-in-dispatcher-s-fleet-requiring-fleet-access-and-a-manifest-filename-before-serving-it-as-an-attachment-ts-4e794dd04dd7 | download-a-stored-csv-dispatch-manifest-for-the-signed-in-dispatcher-s-fleet-requiring-fleet-access-and-a-manifest-filename-before-serving-it-as-an-attachment | fleet-tracking | http-handler | Download a stored CSV dispatch manifest for the signed-in dispatcher's fleet, requiring fleet access and a manifest filename before serving it as an attachment. | ts | import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
import { requireDispatcher } from '../auth'
import { db } from '../db'
// Dispatch manifest downloads.
export async function downloadManifest(request: Request): Promise<Response> {
const dispatcher = await requireDispatcher(request)
c... | 44 | false | true | false | false | false | false | false | false | false | false | noise_comments | 3 | obvious | [] | [
{
"finding_slug": "noise-comments-4e794dd04dd7-l6-l6-8bd67b96",
"flag": "noise_comments",
"start_line": 6,
"end_line": 6,
"excerpt": "// Dispatch manifest downloads.",
"explanation": "This comment restates what the function name says.",
"audit_verdict": "valid"
},
{
"finding_slug... |
download-a-stored-csv-dispatch-manifest-for-the-signed-in-dispatcher-s-fleet-requiring-fleet-access-and-a-manifest-filename-before-serving-it-as-an-attachment-ts-65c9daff3aa1 | download-a-stored-csv-dispatch-manifest-for-the-signed-in-dispatcher-s-fleet-requiring-fleet-access-and-a-manifest-filename-before-serving-it-as-an-attachment | fleet-tracking | http-handler | Download a stored CSV dispatch manifest for the signed-in dispatcher's fleet, requiring fleet access and a manifest filename before serving it as an attachment. | ts | import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
import { requireDispatcher } from '../auth'
import { db } from '../db'
export async function downloadManifest(request: Request): Promise<Response> {
const dispatcher = await requireDispatcher(request)
const url = new URL(request.url)
... | 40 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
download-a-stored-csv-dispatch-manifest-for-the-signed-in-dispatcher-s-fleet-requiring-fleet-access-and-a-manifest-filename-before-serving-it-as-an-attachment-ts-23f5aec7686e | download-a-stored-csv-dispatch-manifest-for-the-signed-in-dispatcher-s-fleet-requiring-fleet-access-and-a-manifest-filename-before-serving-it-as-an-attachment | fleet-tracking | http-handler | Download a stored CSV dispatch manifest for the signed-in dispatcher's fleet, requiring fleet access and a manifest filename before serving it as an attachment. | ts | import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
import { requireDispatcher } from '../auth'
import { db } from '../db'
export async function downloadManifest(request: Request): Promise<Response> {
const dispatcher = await requireDispatcher(request)
const url = new URL(request.url)
... | 40 | true | false | false | false | false | false | false | false | false | false | unclear_naming | 4 | subtle | [] | [
{
"finding_slug": "unclear-naming-23f5aec7686e-l20-l20-c4f9c068",
"flag": "unclear_naming",
"start_line": 20,
"end_line": 20,
"excerpt": " const data = await db.fleet.findFirst({",
"explanation": "The generic name data does not say it holds the fleet record.",
"audit_verdict": "valid"... |
download-a-stored-csv-dispatch-manifest-for-the-signed-in-dispatcher-s-fleet-requiring-fleet-access-and-a-manifest-filename-before-serving-it-as-an-attachment-ts-8c995878d786 | download-a-stored-csv-dispatch-manifest-for-the-signed-in-dispatcher-s-fleet-requiring-fleet-access-and-a-manifest-filename-before-serving-it-as-an-attachment | fleet-tracking | http-handler | Download a stored CSV dispatch manifest for the signed-in dispatcher's fleet, requiring fleet access and a manifest filename before serving it as an attachment. | ts | import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
import { requireDispatcher } from '../auth'
import { db } from '../db'
export async function downloadManifest(request: Request): Promise<Response> {
const dispatcher = await requireDispatcher(request)
const url = new URL(request.url)
... | 38 | false | false | true | false | false | false | false | false | false | true | unsafe_input | 1 | subtle | [] | [
{
"finding_slug": "dead-code-8c995878d786-l27-l27-63aee4ae",
"flag": "dead_code",
"start_line": 27,
"end_line": 27,
"excerpt": " const directory = '/srv/dispatch/manifests'",
"explanation": "The directory variable is assigned but never used because the path repeats the literal.",
"aud... |
render-a-travel-advance-reconciliation-with-cash-and-card-expense-lists-a-sanitized-finance-memo-and-the-cash-amount-the-employee-must-return-or-receive-tsx-30aab67dd418 | render-a-travel-advance-reconciliation-with-cash-and-card-expense-lists-a-sanitized-finance-memo-and-the-cash-amount-the-employee-must-return-or-receive | expense-reports | react-component | Render a travel advance reconciliation with cash and card expense lists, a sanitized finance memo, and the cash amount the employee must return or receive. | tsx | import DOMPurify from 'dompurify';
type Expense = {
id: string;
merchant: string;
cents: number;
method: 'cash' | 'card';
};
type Props = {
advanceCents: number;
expenses: Expense[];
financeMemoHtml: string;
};
export function AdvanceReconciliation({ advanceCents, expenses, financeMemoHtml }: Props) {
const ... | 53 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
render-a-travel-advance-reconciliation-with-cash-and-card-expense-lists-a-sanitized-finance-memo-and-the-cash-amount-the-employee-must-return-or-receive-tsx-ac7f55dde7af | render-a-travel-advance-reconciliation-with-cash-and-card-expense-lists-a-sanitized-finance-memo-and-the-cash-amount-the-employee-must-return-or-receive | expense-reports | react-component | Render a travel advance reconciliation with cash and card expense lists, a sanitized finance memo, and the cash amount the employee must return or receive. | tsx | type Expense = {
id: string;
merchant: string;
cents: number;
method: 'cash' | 'card';
};
type Props = {
advanceCents: number;
expenses: Expense[];
financeMemoHtml: string;
};
export function AdvanceReconciliation({ advanceCents, expenses, financeMemoHtml }: Props) {
const cashExpenses = expenses.filter(expen... | 46 | false | false | false | false | false | true | false | false | false | true | unsafe_input | 1 | subtle | [] | [
{
"finding_slug": "too-clever-ac7f55dde7af-l24-l24-1b994f51",
"flag": "too_clever",
"start_line": 24,
"end_line": 24,
"excerpt": "\tconst balanceLabel = balanceCents ? balanceCents > 0 ? 'Return to finance' : 'Reimbursement due' : 'Advance fully accounted for';",
"explanation": "A nested ter... |
render-a-travel-advance-reconciliation-with-cash-and-card-expense-lists-a-sanitized-finance-memo-and-the-cash-amount-the-employee-must-return-or-receive-tsx-c4d2f3dfc1c1 | render-a-travel-advance-reconciliation-with-cash-and-card-expense-lists-a-sanitized-finance-memo-and-the-cash-amount-the-employee-must-return-or-receive | expense-reports | react-component | Render a travel advance reconciliation with cash and card expense lists, a sanitized finance memo, and the cash amount the employee must return or receive. | tsx | import DOMPurify from 'dompurify';
type Expense = {
id: string;
merchant: string;
cents: number;
method: 'cash' | 'card';
};
type Props = {
advanceCents: number;
expenses: Expense[];
financeMemoHtml: string;
};
export function AdvanceReconciliation({ advanceCents, expenses, financeMemoHtml }: Props) {
const ... | 54 | false | false | true | false | false | false | false | false | false | false | dead_code | 4 | subtle | [] | [
{
"finding_slug": "dead-code-c4d2f3dfc1c1-l19-l19-121179f2",
"flag": "dead_code",
"start_line": 19,
"end_line": 19,
"excerpt": "\tconst cardTotal = cardExpenses.reduce((total, expense) => total + expense.cents, 0);",
"explanation": "The cardTotal variable is assigned but never used.",
"a... |
render-a-travel-advance-reconciliation-with-cash-and-card-expense-lists-a-sanitized-finance-memo-and-the-cash-amount-the-employee-must-return-or-receive-tsx-ee482b9d7103 | render-a-travel-advance-reconciliation-with-cash-and-card-expense-lists-a-sanitized-finance-memo-and-the-cash-amount-the-employee-must-return-or-receive | expense-reports | react-component | Render a travel advance reconciliation with cash and card expense lists, a sanitized finance memo, and the cash amount the employee must return or receive. | tsx | import DOMPurify from 'dompurify';
type Expense = {
id: string;
merchant: string;
cents: number;
method: 'cash' | 'card';
};
type Props = {
advanceCents: number;
expenses: Expense[];
financeMemoHtml: string;
};
export function AdvanceReconciliation({ advanceCents, expenses, financeMemoHtml }: Props) {
const ... | 59 | false | true | false | false | false | false | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "noise-comments-ee482b9d7103-l23-l23-4c368cac",
"flag": "noise_comments",
"start_line": 23,
"end_line": 23,
"excerpt": "\t// Compare spending against the advance paid to the employee.",
"explanation": "This comment restates what the balance comparison does.",
"audit_ver... |
read-a-warehouse-zone-capacity-export-and-print-separate-full-and-near-full-zone-lists-using-an-80-percent-warning-threshold-and-sorting-zone-codes-within-each-list-js-9d013c29a302 | read-a-warehouse-zone-capacity-export-and-print-separate-full-and-near-full-zone-lists-using-an-80-percent-warning-threshold-and-sorting-zone-codes-within-each-list | warehouse-operations | cli-script | Read a warehouse zone capacity export and print separate full and near-full zone lists, using an 80 percent warning threshold and sorting zone codes within each list. | js | import { readFile } from 'node:fs/promises'
import { pathToFileURL } from 'node:url'
import { z } from 'zod'
const zoneSchema = z.array(z.object({
code: z.string().regex(/^[A-Z][A-Z0-9-]{0,19}$/),
occupied: z.number().int().nonnegative().safe(),
capacity: z.number().int().positive().safe()
}))
export class ZoneCap... | 49 | false | false | false | true | false | false | true | false | false | false | duplicated_logic | 2 | obvious | [] | [
{
"finding_slug": "duplicated-logic-9d013c29a302-l31-l42-6117a42e",
"flag": "duplicated_logic",
"start_line": 31,
"end_line": 42,
"excerpt": "\t\tthis.output.write('Full\\n')",
"explanation": "The full and near-full output blocks repeat the same sort and print logic with only the heading and... |
read-a-warehouse-zone-capacity-export-and-print-separate-full-and-near-full-zone-lists-using-an-80-percent-warning-threshold-and-sorting-zone-codes-within-each-list-js-659c93ed2ed3 | read-a-warehouse-zone-capacity-export-and-print-separate-full-and-near-full-zone-lists-using-an-80-percent-warning-threshold-and-sorting-zone-codes-within-each-list | warehouse-operations | cli-script | Read a warehouse zone capacity export and print separate full and near-full zone lists, using an 80 percent warning threshold and sorting zone codes within each list. | js | import { readFile } from 'node:fs/promises'
import { pathToFileURL } from 'node:url'
import { z } from 'zod'
const zoneSchema = z.array(z.object({
code: z.string().regex(/^[A-Z][A-Z0-9-]{0,19}$/),
occupied: z.number().int().nonnegative().safe(),
capacity: z.number().int().positive().safe()
}))
export class ZoneCap... | 50 | false | true | false | false | false | false | false | false | false | false | noise_comments | 4 | obvious | [] | [
{
"finding_slug": "noise-comments-659c93ed2ed3-l35-l35-8ac81f66",
"flag": "noise_comments",
"start_line": 35,
"end_line": 35,
"excerpt": "\t\t// Full zones appear first so supervisors see capacity breaches first.",
"explanation": "This comment restates the order already set by the sections a... |
read-a-warehouse-zone-capacity-export-and-print-separate-full-and-near-full-zone-lists-using-an-80-percent-warning-threshold-and-sorting-zone-codes-within-each-list-js-37267860487a | read-a-warehouse-zone-capacity-export-and-print-separate-full-and-near-full-zone-lists-using-an-80-percent-warning-threshold-and-sorting-zone-codes-within-each-list | warehouse-operations | cli-script | Read a warehouse zone capacity export and print separate full and near-full zone lists, using an 80 percent warning threshold and sorting zone codes within each list. | js | import { readFile } from 'node:fs/promises'
import { pathToFileURL } from 'node:url'
import { z } from 'zod'
const zoneSchema = z.array(z.object({
code: z.string().regex(/^[A-Z][A-Z0-9-]{0,19}$/),
occupied: z.number().int().nonnegative().safe(),
capacity: z.number().int().positive().safe()
}))
export class ZoneCap... | 49 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
read-a-warehouse-zone-capacity-export-and-print-separate-full-and-near-full-zone-lists-using-an-80-percent-warning-threshold-and-sorting-zone-codes-within-each-list-js-1a57df0bc43c | read-a-warehouse-zone-capacity-export-and-print-separate-full-and-near-full-zone-lists-using-an-80-percent-warning-threshold-and-sorting-zone-codes-within-each-list | warehouse-operations | cli-script | Read a warehouse zone capacity export and print separate full and near-full zone lists, using an 80 percent warning threshold and sorting zone codes within each list. | js | import { readFile } from 'node:fs/promises'
import { pathToFileURL } from 'node:url'
import { z } from 'zod'
const zoneSchema = z.array(z.object({
code: z.string().regex(/^[A-Z][A-Z0-9-]{0,19}$/),
occupied: z.number().int().nonnegative().safe(),
capacity: z.number().int().positive().safe()
}))
export class ZoneCap... | 49 | false | false | false | false | false | false | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "duplicated-logic-1a57df0bc43c-l31-l42-6117a42e",
"flag": "duplicated_logic",
"start_line": 31,
"end_line": 42,
"excerpt": "\t\tthis.output.write('Full\\n')",
"explanation": "The full and near-full output blocks repeat the same sort and print logic with only the heading and... |
compare-two-promotion-campaign-windows-and-report-their-shared-active-interval-in-milliseconds-whether-they-target-the-same-campaign-and-the-overlap-duration-in-hours-js-adf315ccf462 | compare-two-promotion-campaign-windows-and-report-their-shared-active-interval-in-milliseconds-whether-they-target-the-same-campaign-and-the-overlap-duration-in-hours | promotions | utility | Compare two promotion campaign windows and report their shared active interval in milliseconds, whether they target the same campaign, and the overlap duration in hours. | js | import { z } from "zod";
const campaignSchema = z.object({
id: z.union([z.string().min(1), z.number().int().positive()]),
startsAt: z.string().datetime({ offset: true }),
endsAt: z.string().datetime({ offset: true })
});
export function promotionWindow(campaign) {
const parsed = campaignSchema.parse(campaign);
c... | 46 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
compare-two-promotion-campaign-windows-and-report-their-shared-active-interval-in-milliseconds-whether-they-target-the-same-campaign-and-the-overlap-duration-in-hours-js-a2a1415dbe5f | compare-two-promotion-campaign-windows-and-report-their-shared-active-interval-in-milliseconds-whether-they-target-the-same-campaign-and-the-overlap-duration-in-hours | promotions | utility | Compare two promotion campaign windows and report their shared active interval in milliseconds, whether they target the same campaign, and the overlap duration in hours. | js | import { z } from "zod";
const campaignSchema = z.object({
id: z.union([z.string().min(1), z.number().int().positive()]),
startsAt: z.string().datetime({ offset: true }),
endsAt: z.string().datetime({ offset: true })
});
export function promotionWindow(campaign) {
const parsed = campaignSchema.parse(campaign);
c... | 54 | false | true | true | false | false | false | true | false | false | false | dead_code | 2 | subtle | [] | [
{
"finding_slug": "dead-code-a2a1415dbe5f-l25-l25-b87e52f3",
"flag": "dead_code",
"start_line": 25,
"end_line": 25,
"excerpt": "\tconst boundaryDates = [first.startsAt, first.endsAt, second.startsAt, second.endsAt];",
"explanation": "The boundaryDates variable is assigned but never used.",
... |
compare-two-promotion-campaign-windows-and-report-their-shared-active-interval-in-milliseconds-whether-they-target-the-same-campaign-and-the-overlap-duration-in-hours-js-bc08de4fa703 | compare-two-promotion-campaign-windows-and-report-their-shared-active-interval-in-milliseconds-whether-they-target-the-same-campaign-and-the-overlap-duration-in-hours | promotions | utility | Compare two promotion campaign windows and report their shared active interval in milliseconds, whether they target the same campaign, and the overlap duration in hours. | js | import { z } from "zod";
const campaignSchema = z.object({
id: z.union([z.string().min(1), z.number().int().positive()]),
startsAt: z.string().datetime({ offset: true }),
endsAt: z.string().datetime({ offset: true })
});
export function promotionWindow(campaign) {
const parsed = campaignSchema.parse(campaign);
c... | 46 | false | false | false | true | false | false | false | false | true | false | type_safety_hole | 2 | subtle | [] | [
{
"finding_slug": "inconsistent-style-bc08de4fa703-l24-l24-d4b2f1d3",
"flag": "inconsistent_style",
"start_line": 24,
"end_line": 24,
"excerpt": "\tvar same_campaign = first.id == second.id",
"explanation": "This line uses var, snake_case and no semicolon while the rest of the file uses cons... |
compare-two-promotion-campaign-windows-and-report-their-shared-active-interval-in-milliseconds-whether-they-target-the-same-campaign-and-the-overlap-duration-in-hours-js-996e3cc9b241 | compare-two-promotion-campaign-windows-and-report-their-shared-active-interval-in-milliseconds-whether-they-target-the-same-campaign-and-the-overlap-duration-in-hours | promotions | utility | Compare two promotion campaign windows and report their shared active interval in milliseconds, whether they target the same campaign, and the overlap duration in hours. | js | import { z } from "zod";
const campaignSchema = z.object({
id: z.union([z.string().min(1), z.number().int().positive()]),
startsAt: z.string().datetime({ offset: true }),
endsAt: z.string().datetime({ offset: true })
});
export function promotionWindow(campaign) {
const parsed = campaignSchema.parse(campaign);
c... | 54 | false | false | true | false | false | false | false | true | true | false | dead_code | 1 | obvious | [] | [
{
"finding_slug": "error-handling-problem-996e3cc9b241-l14-l14-a3c1714b",
"flag": "error_handling_problem",
"start_line": 14,
"end_line": 14,
"excerpt": "\t\tthrow \"Promotion must end after it starts\";",
"explanation": "A string is thrown instead of an Error so callers lose the stack and t... |
build-an-editorial-translation-coverage-report-from-article-locale-records-listing-missing-required-locales-and-completion-percentages-by-article-title-js-82fb82039111 | build-an-editorial-translation-coverage-report-from-article-locale-records-listing-missing-required-locales-and-completion-percentages-by-article-title | content-publishing | data-transform | Build an editorial translation coverage report from article locale records, listing missing required locales and completion percentages by article title. | js | import { z } from "zod";
const articleSchema = z.object({
id: z.string().min(1),
title: z.string().min(1),
translations: z.array(z.object({
locale: z.string().regex(/^[a-z]{2}(?:-[A-Z]{2})?$/),
status: z.enum(["draft", "published"])
}))
});
export function translationCoverage(payload, ... | 49 | false | false | true | false | false | false | false | false | false | false | dead_code | 4 | subtle | [] | [
{
"finding_slug": "dead-code-82fb82039111-l17-l17-7b6c3fb8",
"flag": "dead_code",
"start_line": 17,
"end_line": 17,
"excerpt": " const localeCount = locales.length;",
"explanation": "The localeCount variable is assigned but never used.",
"audit_verdict": "valid"
}
] |
build-an-editorial-translation-coverage-report-from-article-locale-records-listing-missing-required-locales-and-completion-percentages-by-article-title-js-de65cf5a692f | build-an-editorial-translation-coverage-report-from-article-locale-records-listing-missing-required-locales-and-completion-percentages-by-article-title | content-publishing | data-transform | Build an editorial translation coverage report from article locale records, listing missing required locales and completion percentages by article title. | js | import { z } from "zod";
const articleSchema = z.object({
id: z.string().min(1),
title: z.string().min(1),
translations: z.array(z.object({
locale: z.string().regex(/^[a-z]{2}(?:-[A-Z]{2})?$/),
status: z.enum(["draft", "published"])
}))
});
function orderCoverage(report, options) {
... | 54 | false | false | false | false | true | false | false | false | false | false | over_abstracted | 3 | subtle | [] | [
{
"finding_slug": "over-abstracted-de65cf5a692f-l12-l16-914ae604",
"flag": "over_abstracted",
"start_line": 12,
"end_line": 16,
"excerpt": "function orderCoverage(report, options) {",
"explanation": "orderCoverage takes an options object whose titleFirst flag is always true, so the id-only b... |
build-an-editorial-translation-coverage-report-from-article-locale-records-listing-missing-required-locales-and-completion-percentages-by-article-title-js-d98c742433fb | build-an-editorial-translation-coverage-report-from-article-locale-records-listing-missing-required-locales-and-completion-percentages-by-article-title | content-publishing | data-transform | Build an editorial translation coverage report from article locale records, listing missing required locales and completion percentages by article title. | js | import { z } from "zod";
const articleSchema = z.object({
id: z.string().min(1),
title: z.string().min(1),
translations: z.array(z.object({
locale: z.string().regex(/^[a-z]{2}(?:-[A-Z]{2})?$/),
status: z.enum(["draft", "published"])
}))
});
export function translationCoverage(payload, ... | 54 | false | false | false | true | false | false | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "inconsistent-style-d98c742433fb-l28-l28-b4830746",
"flag": "inconsistent_style",
"start_line": 28,
"end_line": 28,
"excerpt": " const in_progress = [];",
"explanation": "The local name in_progress uses snake_case while the rest of the file uses camelCase.",
"aud... |
build-an-editorial-translation-coverage-report-from-article-locale-records-listing-missing-required-locales-and-completion-percentages-by-article-title-js-5d6e9ce1c623 | build-an-editorial-translation-coverage-report-from-article-locale-records-listing-missing-required-locales-and-completion-percentages-by-article-title | content-publishing | data-transform | Build an editorial translation coverage report from article locale records, listing missing required locales and completion percentages by article title. | js | import { z } from "zod";
const articleSchema = z.object({
id: z.string().min(1),
title: z.string().min(1),
translations: z.array(z.object({
locale: z.string().regex(/^[a-z]{2}(?:-[A-Z]{2})?$/),
status: z.enum(["draft", "published"])
}))
});
export function translationCoverage(payload, ... | 48 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
let-a-fleet-dispatcher-change-a-vehicle-s-radio-call-sign-enforce-an-uppercase-letter-and-number-format-and-refresh-the-dispatch-map-after-saving-ts-7e7f33cc5ba1 | let-a-fleet-dispatcher-change-a-vehicle-s-radio-call-sign-enforce-an-uppercase-letter-and-number-format-and-refresh-the-dispatch-map-after-saving | fleet-tracking | server-action | Let a fleet dispatcher change a vehicle's radio call sign, enforce an uppercase letter-and-number format, and refresh the dispatch map after saving. | ts | 'use server';
import { revalidatePath } from 'next/cache';
import { requireDispatcher } from '../auth';
import { db } from '../db';
function handle(path: string) {
revalidatePath(path);
}
export async function changeCallSign(form: FormData) {
const dispatcher = await requireDispatcher();
const vehicleId = form... | 32 | true | false | false | false | true | false | false | false | false | false | over_abstracted | 2 | subtle | [] | [
{
"finding_slug": "unclear-naming-7e7f33cc5ba1-l7-l7-b0f07117",
"flag": "unclear_naming",
"start_line": 7,
"end_line": 7,
"excerpt": "function handle(path: string) {",
"explanation": "The function name handle does not say it refreshes a cached path.",
"audit_verdict": "valid"
},
{
... |
let-a-fleet-dispatcher-change-a-vehicle-s-radio-call-sign-enforce-an-uppercase-letter-and-number-format-and-refresh-the-dispatch-map-after-saving-ts-edde25e8d2f8 | let-a-fleet-dispatcher-change-a-vehicle-s-radio-call-sign-enforce-an-uppercase-letter-and-number-format-and-refresh-the-dispatch-map-after-saving | fleet-tracking | server-action | Let a fleet dispatcher change a vehicle's radio call sign, enforce an uppercase letter-and-number format, and refresh the dispatch map after saving. | ts | 'use server';
import { revalidatePath } from 'next/cache';
import { requireDispatcher } from '../auth';
import { db } from '../db';
export async function changeCallSign(form: FormData) {
const dispatcher = await requireDispatcher();
const vehicleId = form.get('vehicleId');
const callSign = form.get('callSign');... | 27 | false | false | false | false | false | false | false | false | true | false | type_safety_hole | 2 | obvious | [] | [
{
"finding_slug": "type-safety-hole-edde25e8d2f8-l20-l20-119ad0b1",
"flag": "type_safety_hole",
"start_line": 20,
"end_line": 20,
"excerpt": " if (vehicle!.retiredAt) throw new Error('Vehicle retired');",
"explanation": "The non-null assertion on the lookup result bypasses the missing vehic... |
let-a-fleet-dispatcher-change-a-vehicle-s-radio-call-sign-enforce-an-uppercase-letter-and-number-format-and-refresh-the-dispatch-map-after-saving-ts-22804abb5530 | let-a-fleet-dispatcher-change-a-vehicle-s-radio-call-sign-enforce-an-uppercase-letter-and-number-format-and-refresh-the-dispatch-map-after-saving | fleet-tracking | server-action | Let a fleet dispatcher change a vehicle's radio call sign, enforce an uppercase letter-and-number format, and refresh the dispatch map after saving. | ts | 'use server';
import { revalidatePath } from 'next/cache';
import { requireDispatcher } from '../auth';
import { db } from '../db';
export async function changeCallSign(form: FormData) {
const dispatcher = await requireDispatcher();
const vehicleId = form.get('vehicleId');
const callSign = form.get('callSign');... | 28 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
let-a-fleet-dispatcher-change-a-vehicle-s-radio-call-sign-enforce-an-uppercase-letter-and-number-format-and-refresh-the-dispatch-map-after-saving-ts-9161f1f064ba | let-a-fleet-dispatcher-change-a-vehicle-s-radio-call-sign-enforce-an-uppercase-letter-and-number-format-and-refresh-the-dispatch-map-after-saving | fleet-tracking | server-action | Let a fleet dispatcher change a vehicle's radio call sign, enforce an uppercase letter-and-number format, and refresh the dispatch map after saving. | ts | 'use server';
import { revalidatePath } from 'next/cache';
import { requireDispatcher } from '../auth';
import { db } from '../db';
export async function changeCallSign(form: FormData) {
const dispatcher = await requireDispatcher();
const vehicleId = form.get('vehicleId');
const callSign = form.get('callSign');... | 29 | true | false | true | false | false | false | false | false | false | false | dead_code | 3 | subtle | [] | [
{
"finding_slug": "unclear-naming-9161f1f064ba-l17-l17-bc1fccc4",
"flag": "unclear_naming",
"start_line": 17,
"end_line": 17,
"excerpt": " const data = await db.vehicle.findFirst({",
"explanation": "The generic name data does not say it holds the vehicle record.",
"audit_verdict": "vali... |
archive-finalized-invoice-pdfs-from-the-billing-provider-s-manifest-skip-invoices-already-archived-reject-invalid-downloads-and-report-archived-and-skipped-counts-ts-4acf86246aec | archive-finalized-invoice-pdfs-from-the-billing-provider-s-manifest-skip-invoices-already-archived-reject-invalid-downloads-and-report-archived-and-skipped-counts | invoicing | async-job | Archive finalized invoice PDFs from the billing provider's manifest, skip invoices already archived, reject invalid downloads, and report archived and skipped counts. | ts | import { z } from "zod"
import { InvoicePdfClient } from "../billing/pdf-client"
import { InvoiceArchiveStore } from "../archive/invoices"
const manifestSchema = z.array(z.object({
invoiceId: z.string().regex(/^inv_[a-z0-9]+$/),
status: z.enum(["finalized", "draft"]),
url: z.string().url().refine(value => {
const... | 57 | false | true | false | false | true | false | false | true | false | false | error_handling_problem | 1 | obvious | [] | [
{
"finding_slug": "over-abstracted-4acf86246aec-l20-l22-9749a918",
"flag": "over_abstracted",
"start_line": 20,
"end_line": 22,
"excerpt": "\tprivate writeDocument(invoiceId: string, contents: Uint8Array) {",
"explanation": "writeDocument only forwards its arguments to archive.write.",
"... |
archive-finalized-invoice-pdfs-from-the-billing-provider-s-manifest-skip-invoices-already-archived-reject-invalid-downloads-and-report-archived-and-skipped-counts-ts-bd859e049d99 | archive-finalized-invoice-pdfs-from-the-billing-provider-s-manifest-skip-invoices-already-archived-reject-invalid-downloads-and-report-archived-and-skipped-counts | invoicing | async-job | Archive finalized invoice PDFs from the billing provider's manifest, skip invoices already archived, reject invalid downloads, and report archived and skipped counts. | ts | import { z } from "zod"
import { InvoicePdfClient } from "../billing/pdf-client"
import { InvoiceArchiveStore } from "../archive/invoices"
const manifestSchema = z.array(z.object({
invoiceId: z.string(),
status: z.enum(["finalized", "draft"]),
url: z.string()
}))
export class InvoicePdfArchiveJob {
constructor(
... | 45 | false | false | false | false | false | false | false | false | false | true | unsafe_input | 1 | subtle | [] | [
{
"finding_slug": "unsafe-input-bd859e049d99-l31-l31-ebcd9653",
"flag": "unsafe_input",
"start_line": 31,
"end_line": 31,
"excerpt": "\t\t\tconst response = await fetch(document.url, { redirect: \"error\" })",
"explanation": "The manifest url is fetched without validating scheme or host beca... |
archive-finalized-invoice-pdfs-from-the-billing-provider-s-manifest-skip-invoices-already-archived-reject-invalid-downloads-and-report-archived-and-skipped-counts-ts-677223d78efe | archive-finalized-invoice-pdfs-from-the-billing-provider-s-manifest-skip-invoices-already-archived-reject-invalid-downloads-and-report-archived-and-skipped-counts | invoicing | async-job | Archive finalized invoice PDFs from the billing provider's manifest, skip invoices already archived, reject invalid downloads, and report archived and skipped counts. | ts | import { z } from "zod"
import { InvoicePdfClient } from "../billing/pdf-client"
import { InvoiceArchiveStore } from "../archive/invoices"
const manifestSchema = z.array(z.object({
invoiceId: z.string().regex(/^inv_[a-z0-9]+$/),
status: z.enum(["finalized", "draft"]),
url: z.string().url().refine(value => {
const... | 50 | false | false | false | false | false | true | true | false | false | false | duplicated_logic | 2 | subtle | [] | [
{
"finding_slug": "duplicated-logic-677223d78efe-l43-l45-5f4c7f03",
"flag": "duplicated_logic",
"start_line": 43,
"end_line": 45,
"excerpt": "\t\t\tif (new TextDecoder().decode(contents.slice(0, 5)) !== \"%PDF-\" || contents.length > 20000000) {",
"explanation": "The PDF signature and size c... |
archive-finalized-invoice-pdfs-from-the-billing-provider-s-manifest-skip-invoices-already-archived-reject-invalid-downloads-and-report-archived-and-skipped-counts-ts-8ae3836e11bb | archive-finalized-invoice-pdfs-from-the-billing-provider-s-manifest-skip-invoices-already-archived-reject-invalid-downloads-and-report-archived-and-skipped-counts | invoicing | async-job | Archive finalized invoice PDFs from the billing provider's manifest, skip invoices already archived, reject invalid downloads, and report archived and skipped counts. | ts | import { z } from "zod"
import { InvoicePdfClient } from "../billing/pdf-client"
import { InvoiceArchiveStore } from "../archive/invoices"
const manifestSchema = z.array(z.object({
invoiceId: z.string().regex(/^inv_[a-z0-9]+$/),
status: z.enum(["finalized", "draft"]),
url: z.string().url().refine(value => {
const... | 48 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.