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
implement-debounce-logic-for-cart-quantity-updates-to-prevent-excessive-network-requests-while-typing-ts-16c75f55f509
implement-debounce-logic-for-cart-quantity-updates-to-prevent-excessive-network-requests-while-typing
shopping-cart
react-hook
Implement debounce logic for cart quantity updates to prevent excessive network requests while typing
ts
import { useEffect, useState } from "react" type SaveQuantity = (quantity: number) => Promise<void>; export function useCartQuantity(itemId: string, saveQuantity: SaveQuantity) { const [error, setError] = useState<unknown>(null) useEffect(() => { let timer: ReturnType<typeof setTimeout> | undefined; le...
32
false
false
false
true
false
false
false
false
false
false
inconsistent_style
3
obvious
[]
[ { "finding_slug": "inconsistent-style-16c75f55f509-l1-l3-1fae8db6", "flag": "inconsistent_style", "start_line": 1, "end_line": 3, "excerpt": "import { useEffect, useState } from \"react\"", "explanation": "Semicolon-free statements and semicolon-terminated statements are mixed throughout the...
write-automated-tests-for-the-session-duration-calculator-ensuring-edge-cases-like-idle-timeouts-are-handled-correctly-tsx-bed04cc0513c
write-automated-tests-for-the-session-duration-calculator-ensuring-edge-cases-like-idle-timeouts-are-handled-correctly
analytics
test
Write automated tests for the session duration calculator ensuring edge cases like idle timeouts are handled correctly.
tsx
import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import { calculateSessionDuration } from '../sessionDuration'; const startedAt = Date.parse('2025-03-18T09:00:00.000Z'); const idleTimeoutMs = 300_000; const scenarios = [ { name: 'counts elapsed time while the session ...
57
false
false
false
false
false
false
false
false
false
false
none
5
obvious
[]
[]
aggregate-raw-listing-impressions-by-neighborhood-identifier-to-calculate-average-daily-views-per-zone-ts-50fdc01e8182
aggregate-raw-listing-impressions-by-neighborhood-identifier-to-calculate-average-daily-views-per-zone
property-listings
data-transform
Aggregate raw listing impressions by neighborhood identifier to calculate average daily views per zone.
ts
import { z } from "zod" export interface ListingImpression { neighborhoodId: string viewCount: number timestamp: string } export interface ZoneDailyViews { neighborhoodId: string averageDailyViews: number recordedDaysCount: number } const MILLISECONDS_PER_DAY = 86400000 const impressionSchema...
50
false
false
true
false
false
true
false
true
false
false
error_handling_problem
2
obvious
[]
[ { "finding_slug": "dead-code-50fdc01e8182-l15-l15-31931014", "flag": "dead_code", "start_line": 15, "end_line": 15, "excerpt": "const MILLISECONDS_PER_DAY = 86400000", "explanation": "This local constant is never referenced; the implementation groups by UTC date strings instead.", "audit...
attach-click-listeners-to-promotional-banner-buttons-that-copy-referral-codes-directly-to-the-clipboard-ts-3ff8b9dc7766
attach-click-listeners-to-promotional-banner-buttons-that-copy-referral-codes-directly-to-the-clipboard
loyalty-rewards
dom-code
Attach click listeners to promotional banner buttons that copy referral codes directly to the clipboard.
ts
import { trackRewardInteraction } from '@services/analytics' const COPY_FEEDBACK_DURATION_MS = 2500 export function initializeReferralBannerActions(containerElement: HTMLElement): void { const obj = containerElement.querySelector('.loyalty-copy-feedback') if (!(obj instanceof HTMLElement)) { throw new...
41
true
false
false
false
false
true
false
false
false
false
unclear_naming
3
borderline
[ "too_clever" ]
[ { "finding_slug": "unclear-naming-3ff8b9dc7766-l6-l6-9b55031a", "flag": "unclear_naming", "start_line": 6, "end_line": 6, "excerpt": " const obj = containerElement.querySelector('.loyalty-copy-feedback')", "explanation": "The name obj does not communicate that this element displays referr...
calculate-business-hours-elapsed-between-two-timestamps-by-excluding-configured-national-holidays-and-weekend-dates-ts-5fbb986ccdfe
calculate-business-hours-elapsed-between-two-timestamps-by-excluding-configured-national-holidays-and-weekend-dates
scheduling
utility
Calculate business hours elapsed between two timestamps by excluding configured national holidays and weekend dates.
ts
import { uniq } from 'lodash-es'; const DAY_MS = 86_400_000; const HOUR_MS = 3_600_000; function countCalendarDays(start: number, end: number): number { const firstDay = Math.floor(start / DAY_MS); const lastDay = Math.ceil(end / DAY_MS); return Math.max(0, lastDay - firstDay); } // Business dates are UT...
38
false
true
true
false
false
false
true
false
false
false
dead_code
3
borderline
[ "duplicated_logic" ]
[ { "finding_slug": "dead-code-5fbb986ccdfe-l6-l10-4e486981", "flag": "dead_code", "start_line": 6, "end_line": 10, "excerpt": "function countCalendarDays(start: number, end: number): number {", "explanation": "This local calendar-day calculation helper is never referenced or exported and shou...
provide-a-debounced-search-term-state-and-trigger-live-venue-queries-against-the-ticket-catalog-js-1e5ef2912576
provide-a-debounced-search-term-state-and-trigger-live-venue-queries-against-the-ticket-catalog
event-ticketing
react-hook
Provide a debounced search term state and trigger live venue queries against the ticket catalog.
js
import { useEffect, useState } from "react"; import { z } from "zod"; const catalogSchema = z.object({ venues: z.array(z.object({ id: z.string().min(1), name: z.string().min(1) })) }); export function useVenueSearch() { const [term, setTerm] = useState(""); const [debouncedTerm, setDebouncedTerm] = useState("")...
44
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
queue-and-dispatch-nightly-invoice-reminder-emails-to-clients-holding-unpaid-orders-past-their-net-thirty-payment-deadline-ts-e3f86ce1a451
queue-and-dispatch-nightly-invoice-reminder-emails-to-clients-holding-unpaid-orders-past-their-net-thirty-payment-deadline
order-management
async-job
Queue and dispatch nightly invoice reminder emails to clients holding unpaid orders past their net thirty payment deadline
ts
import { z } from 'zod'; import type { Queue } from 'bullmq'; const eventSchema = z.object({ type: z.literal('invoices.nightly'), id: z.string().regex(/^[A-Za-z0-9-]+$/), runAt: z.string().datetime({ offset: true }), orders: z.array(z.object({ id: z.string().regex(/^[A-Za-z0-9-]+$/), em...
51
false
false
false
true
true
true
false
false
true
true
unsafe_input
2
borderline
[ "over_abstracted", "type_safety_hole" ]
[ { "finding_slug": "unsafe-input-e3f86ce1a451-l10-l10-7fef6d36", "flag": "unsafe_input", "start_line": 10, "end_line": 10, "excerpt": " email: z.unknown(),", "explanation": "This field accepts any value without validation, and order.email is subsequently placed in the recipient field o...
generate-annual-w-2-wage-and-tax-statement-pdf-packages-for-postal-mailing-to-active-contractors-ts-e8690ab86187
generate-annual-w-2-wage-and-tax-statement-pdf-packages-for-postal-mailing-to-active-contractors
payroll
cli-script
Generate annual W-2 wage and tax statement PDF packages for postal mailing to active contractors.
ts
import { Command } from "commander"; import { generateContractorW2Packages } from "./services/taxStatementService.js"; // generateContractorW2Packages.ts const program = new Command(); program .name("generate-contractor-w2-packages") .description("Generate annual W-2 wage and tax statement PDF packages for p...
34
false
true
false
false
false
false
false
false
false
true
unsafe_input
2
obvious
[]
[ { "finding_slug": "noise-comments-e8690ab86187-l4-l4-6e357ccd", "flag": "noise_comments", "start_line": 4, "end_line": 4, "excerpt": "// generateContractorW2Packages.ts", "explanation": "This filename-only banner adds no explanation of the script's behavior or purpose.", "audit_verdict":...
process-queued-batch-email-dispatches-by-fetching-user-contact-lists-and-sending-through-the-mail-relay-api-js-9b21f67f89cd
process-queued-batch-email-dispatches-by-fetching-user-contact-lists-and-sending-through-the-mail-relay-api
notifications
async-job
Process queued batch email dispatches by fetching user contact lists and sending through the mail relay API.
js
const { z } = require('zod'); const mailRelay = require('@company/mail-relay-sdk'); const userService = require('../services/userService'); const s1 = z.object({ Records: z.array(z.object({ body: z.string() })) }); const s2 = z.object({ userIds: z.array(z.string().min(1)), templateId: z.string().min(1), metadata: z....
30
true
false
false
false
false
false
false
false
false
true
unsafe_input
3
subtle
[]
[ { "finding_slug": "unclear-naming-9b21f67f89cd-l4-l4-b886d676", "flag": "unclear_naming", "start_line": 4, "end_line": 4, "excerpt": "const s1 = z.object({ Records: z.array(z.object({ body: z.string() })) });", "explanation": "The numbered name s1 does not identify the queue-event schema it ...
define-typescript-interfaces-for-rich-media-attachments-including-dimensions-mime-type-restrictions-and-secure-download-urls-ts-8b3dd97a8a63
define-typescript-interfaces-for-rich-media-attachments-including-dimensions-mime-type-restrictions-and-secure-download-urls
messaging
type-definitions
Define TypeScript interfaces for rich media attachments, including dimensions, mime type restrictions, and secure download URLs.
ts
export interface MediaDimensions { width: number; height: number } export interface SecureDownloadUrl { url: `https://${string}`; expiresAt: string } export interface MimeByKind { image: "image/jpeg" | "image/png" | "image/webp" video: "video/mp4" | "video/webm" audio: "audio/mpeg" | "audio/ogg" } export in...
29
true
false
false
false
false
false
false
false
false
false
unclear_naming
3
obvious
[]
[ { "finding_slug": "unclear-naming-8b3dd97a8a63-l18-l18-b1809478", "flag": "unclear_naming", "start_line": 18, "end_line": 18, "excerpt": "export function extractAttachmentDimensions(a: RichMediaAttachment): MediaDimensions {", "explanation": "The parameter name `a` does not describe the atta...
group-published-articles-by-primary-category-and-aggregate-total-monthly-view-counts-for-analytics-charts-ts-e78fb2937b9c
group-published-articles-by-primary-category-and-aggregate-total-monthly-view-counts-for-analytics-charts
content-publishing
data-transform
Group published articles by primary category and aggregate total monthly view counts for analytics charts.
ts
import { chain } from 'lodash' import { z } from 'zod' const monthSchema = z.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/) const recordsSchema = z.array(z.object({ articleId: z.string().min(1), status: z.enum(['draft', 'published', 'archived']), month: monthSchema, primaryCategory: z.string().trim().min(1)...
44
false
false
false
false
false
true
false
false
false
false
too_clever
3
obvious
[]
[ { "finding_slug": "too-clever-e78fb2937b9c-l25-l39-3045f5e8", "flag": "too_clever", "start_line": 25, "end_line": 39, "excerpt": " const categoryTotals = records.reduce((totals, article) => (", "explanation": "The reducer combines filtering, conditional map initialization, and accumulatio...
persist-a-new-percentage-rollout-split-configuration-submitted-from-the-feature-flag-creation-form-into-persistent-storage-ts-af9ddce951b4
persist-a-new-percentage-rollout-split-configuration-submitted-from-the-feature-flag-creation-form-into-persistent-storage
feature-flags
server-action
Persist a new percentage rollout split configuration submitted from the feature flag creation form into persistent storage.
ts
import { redirect, type ActionFunctionArgs } from "@remix-run/node"; import { z } from "zod"; import { db } from "~/utils/db.server"; import { requireUserSession } from "~/utils/auth.server"; const bucketKey = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/); const allocationSchema = z.record(bucketKey, z.number(...
30
false
true
true
false
false
false
false
false
false
true
unsafe_input
2
obvious
[]
[ { "finding_slug": "noise-comments-af9ddce951b4-l13-l13-62749938", "flag": "noise_comments", "start_line": 13, "end_line": 13, "excerpt": " // Require the user session.", "explanation": "Restates the immediately following requireUserSession call without adding rationale.", "audit_verdi...
render-a-badge-component-that-displays-current-battery-voltage-and-alternator-health-metrics-for-electric-delivery-trucks-tsx-ff4b6082c0c0
render-a-badge-component-that-displays-current-battery-voltage-and-alternator-health-metrics-for-electric-delivery-trucks
fleet-tracking
react-component
Render a badge component that displays current battery voltage and alternator health metrics for electric delivery trucks.
tsx
interface DeliveryTruckElectricalMetrics { batteryVoltage: number; alternatorStatus: 'OPTIMAL' | 'DEGRADED' | 'FAULT'; } interface FleetElectricalBadgeProps { metrics: DeliveryTruckElectricalMetrics; } const STATUS_STYLES = { OPTIMAL: 'bg-emerald-500/10 text-emerald-700 border-emerald-200', DEGRADED: 'bg-amber-...
20
false
false
false
false
false
false
false
false
false
false
none
5
obvious
[]
[]
receive-carrier-status-webhooks-validate-request-signatures-and-update-shipment-location-records-in-database-ts-8ab40a988608
receive-carrier-status-webhooks-validate-request-signatures-and-update-shipment-location-records-in-database
shipping
http-handler
Receive carrier status webhooks, validate request signatures, and update shipment location records in database
ts
import { createHmac, timingSafeEqual } from 'node:crypto'; import type { FastifyInstance } from 'fastify'; import type { PrismaClient } from '@prisma/client'; import { z } from 'zod'; const carrierEvent = z.object({ trackingNumber: z.string().trim().min(1).max(100), status: z.enum(['in_transit', 'delivered', 'except...
39
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
check-that-negative-inventory-adjustment-quantities-correctly-trigger-validation-error-responses-js-0951e0305211
check-that-negative-inventory-adjustment-quantities-correctly-trigger-validation-error-responses
inventory
test
Check that negative inventory adjustment quantities correctly trigger validation error responses.
js
const request = require('supertest'); const app = require('../src/app'); describe('POST /inventory/adjustments', () => { test.each([-1, -12])('rejects quantity %i', async (quantity) => { const response = await request(app) .post('/inventory/adjustments') .send({ sku: 'BOLT-M8', wareho...
25
false
false
false
false
false
false
false
false
false
false
none
5
obvious
[]
[]
render-a-stock-adjustment-modal-dialog-with-input-fields-for-counted-quantity-and-reason-selection-tsx-5814acb1aadf
render-a-stock-adjustment-modal-dialog-with-input-fields-for-counted-quantity-and-reason-selection
inventory
react-component
Render a stock adjustment modal dialog with input fields for counted quantity and reason selection.
tsx
import { useState } from 'react' interface StockModalProps { sku: string onClose: () => void onSubmit: (data: { count: number; reason: string }) => Promise<void> } export function StockAdjustmentModal({ sku, onClose, onSubmit }: StockModalProps) { const [v, setV] = useState('') const [r, setR] = useState('d...
43
true
false
false
false
false
false
false
false
false
false
unclear_naming
3
obvious
[]
[ { "finding_slug": "unclear-naming-5814acb1aadf-l6-l6-09a3e57e", "flag": "unclear_naming", "start_line": 6, "end_line": 6, "excerpt": " onSubmit: (data: { count: number; reason: string }) => Promise<void>", "explanation": "The generic parameter name data does not identify the stock adjustmen...
assert-that-the-sla-calculation-utility-correctly-identifies-breached-support-tickets-when-response-times-exceed-the-twenty-four-hour-limit-js-4762a0b1d019
assert-that-the-sla-calculation-utility-correctly-identifies-breached-support-tickets-when-response-times-exceed-the-twenty-four-hour-limit
customer-support
test
Assert that the SLA calculation utility correctly identifies breached support tickets when response times exceed the twenty-four hour limit.
js
import test from 'node:test'; import assert from 'node:assert/strict'; import { calculateTicketSla } from '../src/support/sla.js'; const createdAt = '2025-03-12T09:00:00.000Z'; const responseCases = [ { id: 'SUP-801', firstResponseAt: '2025-03-13T09:00:00.001Z', elapsed: 86400001, breached: true }, { id: 'SUP-802'...
27
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
define-typescript-interfaces-representing-granular-access-control-lists-and-hierarchical-role-schemas-ts-37ec76b45163
define-typescript-interfaces-representing-granular-access-control-lists-and-hierarchical-role-schemas
permissions
type-definitions
Define TypeScript interfaces representing granular access control lists and hierarchical role schemas.
ts
export interface AccessRule<Resource extends string = string, Action extends string = string> { resource: Resource; // Keep the rule's actions in a readonly collection. actions: ReadonlyArray<Action> extends infer Actions ? Actions extends readonly unknown[] ? Actions : never : never; ef...
20
false
true
false
false
false
true
false
false
false
false
too_clever
3
obvious
[]
[ { "finding_slug": "noise-comments-37ec76b45163-l3-l3-18891eef", "flag": "noise_comments", "start_line": 3, "end_line": 3, "excerpt": " // Keep the rule's actions in a readonly collection.", "explanation": "This repeats the readonly collection declaration without explaining a reason or con...
calculate-estimated-reading-time-in-minutes-based-on-total-word-count-and-standard-reading-speeds-js-251e8530ff50
calculate-estimated-reading-time-in-minutes-based-on-total-word-count-and-standard-reading-speeds
content-publishing
utility
Calculate estimated reading time in minutes based on total word count and standard reading speeds.
js
import { has, isSafeInteger } from 'lodash'; const rates = Object.freeze({ slow: 200, standard: 250, fast: 300 }); export function estimateReadingTime(a, b = 'standard') { try { if (!isSafeInteger(a)) { throw new TypeError('Word count must be a safe integer.'); } i...
37
true
false
false
false
false
false
false
true
false
false
error_handling_problem
2
obvious
[]
[ { "finding_slug": "unclear-naming-251e8530ff50-l9-l9-d2a51fa4", "flag": "unclear_naming", "start_line": 9, "end_line": 9, "excerpt": "export function estimateReadingTime(a, b = 'standard') {", "explanation": "Parameter a does not communicate that it holds the total word count, so rename it w...
define-typescript-interfaces-representing-granular-access-control-lists-and-hierarchical-role-schemas-ts-93d208a5c433
define-typescript-interfaces-representing-granular-access-control-lists-and-hierarchical-role-schemas
permissions
type-definitions
Define TypeScript interfaces representing granular access control lists and hierarchical role schemas.
ts
type LegacyRoleParent = string | null; type RuleEffect = any; export interface AccessRule<Resource extends string = string, Action extends string = string> { resource: Resource; actions: readonly Action[]; effect: RuleEffect; } export interface AccessList<Resource extends string = string, Action extends s...
18
false
false
true
false
false
false
false
false
true
false
type_safety_hole
2
obvious
[]
[ { "finding_slug": "dead-code-93d208a5c433-l1-l1-6ba12a01", "flag": "dead_code", "start_line": 1, "end_line": 1, "excerpt": "type LegacyRoleParent = string | null;", "explanation": "This non-exported type alias is never referenced.", "audit_verdict": "valid" }, { "finding_slug": "...
subscribe-to-the-websocket-notification-channel-and-return-the-latest-incoming-message-object-to-callers-js-536f3ecc2601
subscribe-to-the-websocket-notification-channel-and-return-the-latest-incoming-message-object-to-callers
notifications
react-hook
Subscribe to the WebSocket notification channel and return the latest incoming message object to callers.
js
import useSWRSubscription from 'swr/subscription'; function notificationPreview(notification, limit = 80) { const message = notification.message.replace(/\s+/g, ' ').trim(); if (message.length <= limit) { return message; } const prefix = message.slice(0, limit - 1).trimEnd(); return `${pref...
35
false
false
true
false
false
false
false
false
false
true
unsafe_input
3
subtle
[]
[ { "finding_slug": "dead-code-536f3ecc2601-l3-l10-c884a523", "flag": "dead_code", "start_line": 3, "end_line": 10, "excerpt": "function notificationPreview(notification, limit = 80) {", "explanation": "This local preview formatter is never referenced or exported and should be removed from the...
process-the-nightly-queue-worker-dispatching-reminder-emails-for-assignments-due-within-the-next-twenty-four-hours-js-2f8ec824d20b
process-the-nightly-queue-worker-dispatching-reminder-emails-for-assignments-due-within-the-next-twenty-four-hours
course-management
async-job
Process the nightly queue worker dispatching reminder emails for assignments due within the next twenty-four hours.
js
const cron = require('node-cron') const { z } = require('zod') const db = require('./db') const mailer = require('./mailer') const assignmentsSchema = z.array(z.object({ id: z.number().int().positive(), student_email: z.unknown(), course_title: z.string().min(1), due_date: z.date() })) function dispatchAssign...
54
false
false
false
false
false
false
true
false
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "unsafe-input-2f8ec824d20b-l8-l8-7455e539", "flag": "unsafe_input", "start_line": 8, "end_line": 8, "excerpt": " student_email: z.unknown(),", "explanation": "This field accepts any value, so parsing does not validate the database-sourced recipient before it is passed to s...
provide-a-debounced-search-term-state-and-auto-fetching-list-of-matching-invoice-records-by-vendor-name-or-tax-number-js-6a9175e957c9
provide-a-debounced-search-term-state-and-auto-fetching-list-of-matching-invoice-records-by-vendor-name-or-tax-number
invoicing
react-hook
Provide a debounced search term state and auto-fetching list of matching invoice records by vendor name or tax number.
js
import { useEffect, useState } from 'react'; import { z } from 'zod'; const invoiceList = z.array(z.object({ id: z.string().min(1), vendorName: z.string(), taxNumber: z.string(), totalCents: z.number().int().nonnegative() })); export function useInvoiceSearch() { const [searchTerm, updateSearchTerm] = use...
51
false
true
false
true
false
false
false
false
false
false
inconsistent_style
4
subtle
[]
[ { "finding_slug": "inconsistent-style-6a9175e957c9-l33-l33-63e498ce", "flag": "inconsistent_style", "start_line": 33, "end_line": 33, "excerpt": " const records = await response.json().then(payload => invoiceList.parse(payload));", "explanation": "This mixes a .then chain with...
manage-the-active-curriculum-filter-slice-in-the-global-store-to-toggle-modules-between-published-and-draft-states-js-95f753178dab
manage-the-active-curriculum-filter-slice-in-the-global-store-to-toggle-modules-between-published-and-draft-states
course-management
state-management
Manage the active curriculum filter slice in the global store to toggle modules between published and draft states.
js
import { createSelector } from 'reselect'; const initialState = { status: 'published' }; const filter_states = ['published', 'draft']; const filterLabels = { published: 'Published modules', draft: 'Draft modules' }; const selectFilter = (state) => state.curriculumFilter; const selectModules = (state) => state.modules;...
36
false
false
true
true
false
true
false
false
false
false
too_clever
3
obvious
[]
[ { "finding_slug": "inconsistent-style-95f753178dab-l4-l4-7eec6559", "flag": "inconsistent_style", "start_line": 4, "end_line": 4, "excerpt": "const filter_states = ['published', 'draft'];", "explanation": "Uses snake_case alongside camelCase declarations such as initialState and selectFilter...
attach-live-input-validation-and-currency-formatting-listeners-to-the-hourly-wage-entry-table-cells-ts-a29096c0bb3e
attach-live-input-validation-and-currency-formatting-listeners-to-the-hourly-wage-entry-table-cells
payroll
dom-code
Attach live input validation and currency formatting listeners to the hourly wage entry table cells.
ts
import { updatePayrollRecord } from '../api/payrollClient.js'; interface WageIdentity { employeeId: string; } function readHourlyWage(value: string): number | null { const text = value.trim(); if (!/^\$?\d+(?:\.\d{1,2})?$/.test(text)) { return null; } const wage = Number(text.replace(/^\$/, '')); retu...
50
false
false
false
false
false
false
true
false
true
true
type_safety_hole
2
borderline
[ "type_safety_hole" ]
[ { "finding_slug": "type-safety-hole-a29096c0bb3e-l18-l18-ae8d0453", "flag": "type_safety_hole", "start_line": 18, "end_line": 18, "excerpt": " const input = event.target as HTMLInputElement;", "explanation": "The delegated event target is asserted to be HTMLInputElement without checking i...
define-typescript-interfaces-for-customer-contact-profiles-communication-preferences-and-lead-scores-ts-840576069a0e
define-typescript-interfaces-for-customer-contact-profiles-communication-preferences-and-lead-scores
crm
type-definitions
Define TypeScript interfaces for customer contact profiles, communication preferences, and lead scores.
ts
export type CommunicationChannel = "email" | "sms" | "phone"; type Reach = { channels: CommunicationChannel[]; doNotContact: boolean; }; type ContactPreferenceRecord<PreferenceFields> = { [Field in keyof PreferenceFields]: PreferenceFields[Field]; }; // Expose the contact's communication preferences. export...
22
false
true
false
false
true
false
false
false
false
false
over_abstracted
3
subtle
[]
[ { "finding_slug": "over-abstracted-840576069a0e-l6-l10-7e0d686a", "flag": "over_abstracted", "start_line": 6, "end_line": 10, "excerpt": "type ContactPreferenceRecord<PreferenceFields> = {", "explanation": "The identity mapped type ContactPreferenceRecord is instantiated only with Reach and ...
map-raw-room-inventory-availability-records-into-grouped-arrays-categorized-by-floor-level-and-bedding-ts-9e5e7693c04c
map-raw-room-inventory-availability-records-into-grouped-arrays-categorized-by-floor-level-and-bedding
hotel-booking
data-transform
Map raw room inventory availability records into grouped arrays categorized by floor level and bedding.
ts
import { z } from 'zod'; const inventorySchema = z.array(z.object({ roomId: z.string().trim().min(1), floor: z.number().int().min(-5).max(120), bedding: z.enum(['single', 'double', 'twin', 'king']), available: z.boolean(), })); type Bedding = z.infer<typeof inventorySchema>[number]['bedding']; export type RoomGro...
43
false
false
false
true
false
false
false
false
false
false
inconsistent_style
4
subtle
[]
[ { "finding_slug": "inconsistent-style-9e5e7693c04c-l23-l31-83f54c7d", "flag": "inconsistent_style", "start_line": 23, "end_line": 31, "excerpt": "\t\tlet bedding_groups = floorGroups.get(record.floor);", "explanation": "The local bedding_groups uses snake_case alongside camelCase locals such...
implement-a-zustand-store-slice-holding-active-search-facets-selected-category-filters-and-cursor-js-3f3dfd947d95
implement-a-zustand-store-slice-holding-active-search-facets-selected-category-filters-and-cursor
search
state-management
Implement a Zustand store slice holding active search facets, selected category filters, and cursor.
js
import { z } from "zod" const facetSchema = z.object({ facetKey: z.string().min(1).refine((key) => !Object.prototype.hasOwnProperty.call(Object.prototype, key) ), facetValue: z.union([z.string(), z.number().finite(), z.boolean()]) }) const categorySchema = z.union([z.string().min(1), z.number().finite()]) co...
52
false
false
false
false
false
false
false
false
true
false
type_safety_hole
3
subtle
[]
[ { "finding_slug": "type-safety-hole-3f3dfd947d95-l23-l23-85b9b0fc", "flag": "type_safety_hole", "start_line": 23, "end_line": 23, "excerpt": " const { facetKey, facetValue } = selection.data", "explanation": "Because safeParse can return a failure with no data, destructuring selection.dat...
evaluate-user-attribute-strings-against-a-semver-range-comparison-operator-for-percentage-based-feature-flag-targeting-ts-4e488314903f
evaluate-user-attribute-strings-against-a-semver-range-comparison-operator-for-percentage-based-feature-flag-targeting
feature-flags
utility
Evaluate user attribute strings against a semver range comparison operator for percentage-based feature flag targeting.
ts
import semver from "semver" import { createHash } from "crypto" import { z } from "zod" export type TargetingContext = { userId: string userAttributes: Record<string, string> } export type FeatureFlagRule = { attributeKey: string semverRange: string rolloutPercentage: number } const contextSchema = z.objec...
47
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
attach-native-dom-event-listeners-to-render-a-custom-date-range-picker-tooltip-when-hovering-over-sparkline-data-points-js-35b87a11c708
attach-native-dom-event-listeners-to-render-a-custom-date-range-picker-tooltip-when-hovering-over-sparkline-data-points
analytics
dom-code
Attach native DOM event listeners to render a custom date range picker tooltip when hovering over sparkline data points.
js
export function attachRangeTooltip(root, tooltip) { // Handle hovering over a point. const show = (event) => { try { if (!(event.target instanceof Element)) return; const point = event.target.closest("[data-range-start]"); if (!point || !root.contains(point)) return; ...
41
false
true
false
true
false
false
false
true
false
false
error_handling_problem
2
obvious
[]
[ { "finding_slug": "noise-comments-35b87a11c708-l2-l2-21e6a6fb", "flag": "noise_comments", "start_line": 2, "end_line": 2, "excerpt": " // Handle hovering over a point.", "explanation": "Restates the purpose already apparent from the show handler and mouseover registration.", "audit_ve...
check-that-signing-requests-expire-precisely-twenty-four-hours-after-creation-when-no-manual-extension-is-triggered-by-the-sender-ts-1b81d3a3246c
check-that-signing-requests-expire-precisely-twenty-four-hours-after-creation-when-no-manual-extension-is-triggered-by-the-sender
document-signing
test
Check that signing requests expire precisely twenty-four hours after creation when no manual extension is triggered by the sender.
ts
import request from 'supertest'; import { z } from 'zod'; import { app } from '../src/app.js'; import { SigningRequestModel } from '../src/models/SigningRequest.js'; const statusResponse = z.object({ status: z.enum(['PENDING', 'EXPIRED']) }); describe('GET /api/v1/signing-requests/:id/status', () => { it('expires...
43
true
true
false
false
false
false
false
false
false
false
unclear_naming
3
subtle
[]
[ { "finding_slug": "noise-comments-1b81d3a3246c-l12-l12-55e7ddbb", "flag": "noise_comments", "start_line": 12, "end_line": 12, "excerpt": " // Create a pending signing request without a sender extension.", "explanation": "This comment repeats the creation call and its explicit status a...
queue-and-dispatch-nightly-invoice-reminder-emails-to-clients-holding-unpaid-orders-past-their-net-thirty-payment-deadline-ts-8ab07f3f9eb4
queue-and-dispatch-nightly-invoice-reminder-emails-to-clients-holding-unpaid-orders-past-their-net-thirty-payment-deadline
order-management
async-job
Queue and dispatch nightly invoice reminder emails to clients holding unpaid orders past their net thirty payment deadline
ts
import { z } from 'zod'; import type { Queue } from 'bullmq'; const eventSchema = z.object({ type: z.literal('invoices.nightly'), id: z.string().regex(/^[A-Za-z0-9-]+$/), runAt: z.string().datetime({ offset: true }), orders: z.array(z.object({ id: z.string().regex(/^[A-Za-z0-9-]+$/), email: z.unkno...
23
false
false
false
false
false
true
false
false
false
true
too_clever
2
obvious
[]
[ { "finding_slug": "unsafe-input-8ab07f3f9eb4-l8-l8-29ff080b", "flag": "unsafe_input", "start_line": 8, "end_line": 8, "excerpt": " id: z.string().regex(/^[A-Za-z0-9-]+$/), email: z.unknown(),", "explanation": "email remains completely unchecked despite the enclosing schema parse and i...
check-that-overlapping-time-entries-trigger-validation-errors-when-submitted-for-weekly-approval-jsx-65d2e5e43056
check-that-overlapping-time-entries-trigger-validation-errors-when-submitted-for-weekly-approval
time-tracking
test
Check that overlapping time entries trigger validation errors when submitted for weekly approval.
jsx
import { render, screen, within } from "@testing-library/react" import userEvent from "@testing-library/user-event" import "@testing-library/jest-dom" import { WeeklyApproval } from "../WeeklyApproval" const entries = [ { id: "entry-17", project: "Client migration", start: "2025-03-03T09:00...
52
false
false
true
false
false
false
true
false
false
false
dead_code
3
borderline
[ "duplicated_logic" ]
[ { "finding_slug": "dead-code-65d2e5e43056-l21-l23-d0d3823c", "flag": "dead_code", "start_line": 21, "end_line": 23, "excerpt": "const recordedMinutes = entries.reduce((minutes, entry) => {", "explanation": "recordedMinutes is calculated but never used by the test or exported, so the unused c...
assert-that-the-sla-calculation-utility-correctly-identifies-breached-support-tickets-when-response-times-exceed-the-twenty-four-hour-limit-js-c21cb1179925
assert-that-the-sla-calculation-utility-correctly-identifies-breached-support-tickets-when-response-times-exceed-the-twenty-four-hour-limit
customer-support
test
Assert that the SLA calculation utility correctly identifies breached support tickets when response times exceed the twenty-four hour limit.
js
import test from 'node:test'; import assert from 'node:assert/strict'; import { calculateTicketSla } from '../src/support/sla.js'; const createdAt = '2025-03-12T09:00:00.000Z'; test('response SLA is breached only after twenty-four hours', () => { const results = [ calculateTicketSla({ id: 'SUP-801', createdAt, ...
29
false
false
false
false
false
false
true
false
true
false
duplicated_logic
3
borderline
[ "duplicated_logic" ]
[ { "finding_slug": "duplicated-logic-c21cb1179925-l9-l11-fa342872", "flag": "duplicated_logic", "start_line": 9, "end_line": 11, "excerpt": " calculateTicketSla({ id: 'SUP-801', createdAt, firstResponseAt: '2025-03-13T09:00:00.001Z' }),", "explanation": "Three calls repeat the same ticket ...
format-a-raw-phone-number-string-into-the-standard-international-e-164-representation-ts-486052db17cd
format-a-raw-phone-number-string-into-the-standard-international-e-164-representation
crm
utility
Format a raw phone number string into the standard international E.164 representation.
ts
import { parsePhoneNumberFromString } from 'libphonenumber-js/max' export function formatPhoneNumber(raw: string): string { if (typeof raw !== 'string') { throw new TypeError('Phone number must be a string') } const trimmed = raw.trim() const international = trimmed.startsWith('+') ? trimmed : trim...
22
false
false
true
false
false
true
true
false
false
false
too_clever
3
borderline
[ "dead_code", "duplicated_logic" ]
[ { "finding_slug": "too-clever-486052db17cd-l8-l12-965ea9c0", "flag": "too_clever", "start_line": 8, "end_line": 12, "excerpt": " const international = trimmed.startsWith('+')", "explanation": "The nested ternary obscures the simple normalization rule of replacing a leading '00' with '+' and...
track-barcode-scanner-keyboard-input-events-to-instantly-focus-matching-inventory-items-on-screen-js-58c1fdcd2a93
track-barcode-scanner-keyboard-input-events-to-instantly-focus-matching-inventory-items-on-screen
inventory
react-hook
Track barcode scanner keyboard input events to instantly focus matching inventory items on screen.
js
import { useEffect } from 'react'; export function useBarcodeFocus(items = JSON.parse(window.localStorage.getItem('inventory.items'))) { useEffect(() => { let barcode = ''; let lastKeyAt = 0; function onScannerKey(event) { if (event.isComposing || event.repeat || event.ctrlKey || event.altKey || e...
35
false
false
false
false
false
false
false
false
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "unsafe-input-58c1fdcd2a93-l3-l3-d42fe863", "flag": "unsafe_input", "start_line": 3, "end_line": 3, "excerpt": "export function useBarcodeFocus(items = JSON.parse(window.localStorage.getItem('inventory.items'))) {", "explanation": "The default inventory comes from localStor...
execute-a-sql-query-fetching-all-high-value-accounts-with-no-interaction-recorded-in-the-past-ninety-days-ts-91dc74322964
execute-a-sql-query-fetching-all-high-value-accounts-with-no-interaction-recorded-in-the-past-ninety-days
crm
database-access
Execute a SQL query fetching all high-value accounts with no interaction recorded in the past ninety days.
ts
import { z } from "zod" import { pool } from "../db/postgres.js" const accountRow = z.object({ accountId: z.string().regex(/^[a-f0-9]{24}$/), name: z.string().min(1), annualRevenue: z.number().finite().min(100000), lastInteractionAt: z.date().nullable() }) export type DormantAccount = z.infer<typeof accountRo...
44
false
false
true
true
false
false
false
false
true
false
type_safety_hole
3
obvious
[]
[ { "finding_slug": "dead-code-91dc74322964-l13-l18-6627eb4b", "flag": "dead_code", "start_line": 13, "end_line": 18, "excerpt": "function revenueLabel(amount: number): string {", "explanation": "This local currency-formatting helper is never referenced.", "audit_verdict": "valid" }, {...
render-the-multi-factor-authentication-setup-modal-containing-the-qr-code-image-and-a-six-digit-verification-code-input-jsx-01226dfeff49
render-the-multi-factor-authentication-setup-modal-containing-the-qr-code-image-and-a-six-digit-verification-code-input
auth
react-component
Render the multi-factor authentication setup modal containing the QR code image and a six-digit verification code input
jsx
import { useState } from 'react'; import styled from 'styled-components'; const Modal = styled.dialog` border: 0; border-radius: 12px; padding: 24px; width: min(360px, 90vw); img { display: block; margin: 16px auto; } input { display: block; margin: 8px 0 16px; } `; const formatRecoveryCodes = (codes) => c...
45
false
false
true
false
false
false
false
false
false
false
dead_code
3
subtle
[]
[ { "finding_slug": "dead-code-01226dfeff49-l12-l12-44884d47", "flag": "dead_code", "start_line": 12, "end_line": 12, "excerpt": "const formatRecoveryCodes = (codes) => codes.join('\\n');", "explanation": "The local helper formatRecoveryCodes is never referenced and should be removed.", "a...
process-server-actions-for-saving-user-search-queries-and-retrieving-recent-search-history-logs-js-5a1731c1f3dc
process-server-actions-for-saving-user-search-queries-and-retrieving-recent-search-history-logs
search
server-action
Process server actions for saving user search queries and retrieving recent search history logs.
js
const { json } = require('@remix-run/node'); const { recordSearchQuery, fetchSearchHistory } = require('~/models/search.server'); async function action({ request }) { const formData = await request.formData(); const intent = formData.get('intent'); if (intent === 'save') { const userId = formData.g...
30
false
false
false
false
false
false
true
false
true
true
type_safety_hole
3
subtle
[]
[ { "finding_slug": "type-safety-hole-5a1731c1f3dc-l12-l12-22300bd0", "flag": "type_safety_hole", "start_line": 12, "end_line": 12, "excerpt": " const query = formData.get('query').trim();", "explanation": "FormData.get can return null when the field is missing or a File rather than a s...
import-historical-csv-transaction-records-into-the-loyalty-ledger-database-during-system-migration-js-01137283f562
import-historical-csv-transaction-records-into-the-loyalty-ledger-database-during-system-migration
loyalty-rewards
cli-script
Import historical CSV transaction records into the loyalty ledger database during system migration.
js
const { Command } = require('commander'); const { readFile } = require('node:fs/promises'); const { parse } = require('csv-parse/sync'); const { Client } = require('pg'); async function importHistory(file) { const records = parse(await readFile(file, 'utf8'), { columns: true, skip_empty_lines: true }); c...
41
false
true
false
false
false
false
true
true
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "unsafe-input-01137283f562-l7-l10-39394f40", "flag": "unsafe_input", "start_line": 7, "end_line": 10, "excerpt": " const records = parse(await readFile(file, 'utf8'), {", "explanation": "CSV parsing checks syntax rather than ledger record validity, so file-supplied IDs, da...
define-typescript-interfaces-for-user-profile-preferences-notification-settings-and-privacy-permissions-ts-c67c25053c9c
define-typescript-interfaces-for-user-profile-preferences-notification-settings-and-privacy-permissions
user-profiles
type-definitions
Define TypeScript interfaces for user profile preferences, notification settings, and privacy permissions.
ts
export type ThemeMode = 'light' | 'dark' | 'system'; export type LanguageCode = 'en-US' | 'es-ES' | 'fr-FR' | 'de-DE'; type Delivery = 'realtime' | 'daily' | 'weekly'; export interface NotificationSettings { emailAlerts: boolean; pushAlerts: boolean; smsAlerts: boolean; digestFrequency: Delivery; } export in...
46
false
false
false
false
true
false
false
false
false
false
over_abstracted
4
subtle
[]
[ { "finding_slug": "over-abstracted-c67c25053c9c-l40-l46-2098126a", "flag": "over_abstracted", "start_line": 40, "end_line": 46, "excerpt": "interface PreferenceResponseEnvelope<Preferences> {", "explanation": "The generic envelope is instantiated only with UserProfilePreferences and then exp...
process-queued-multipart-upload-parts-in-the-background-to-assemble-final-target-objects-in-remote-bucket-storage-js-4663ac933ec1
process-queued-multipart-upload-parts-in-the-background-to-assemble-final-target-objects-in-remote-bucket-storage
file-uploads
async-job
Process queued multipart upload parts in the background to assemble final target objects in remote bucket storage.
js
import { S3Client, CompleteMultipartUploadCommand } from "@aws-sdk/client-s3" import { z } from "zod" import { db } from "../services/database.js" import { redis } from "../services/redis.js" const s3 = new S3Client({ region: "us-east-1" }) const text = z.string().trim().min(1) const assemblyJob = z.object({ attempt...
46
false
true
false
false
false
false
false
true
true
false
error_handling_problem
2
obvious
[]
[ { "finding_slug": "noise-comments-4663ac933ec1-l20-l20-c9ca4059", "flag": "noise_comments", "start_line": 20, "end_line": 20, "excerpt": " // Sort the parts by their part numbers", "explanation": "Restates the immediately following sort without explaining a constraint or rationale.", "a...
define-a-zustand-store-slice-holding-active-user-point-balance-unlocked-perks-and-redemption-history-ts-ee6cdae21554
define-a-zustand-store-slice-holding-active-user-point-balance-unlocked-perks-and-redemption-history
loyalty-rewards
state-management
Define a Zustand store slice holding active user point balance, unlocked perks, and redemption history.
ts
import { create } from 'zustand'; import { redux } from 'zustand/middleware'; import { z } from 'zod'; const redemptionSchema = z.object({ id: z.string().min(1), perkId: z.string().min(1), points: z.number().int().positive(), redeemedAt: z.number().int().nonnegative(), }); const rewardsSchema = z.object({ ...
40
false
false
false
false
false
true
false
false
false
false
too_clever
3
obvious
[]
[ { "finding_slug": "too-clever-ee6cdae21554-l27-l27-1fb111b5", "flag": "too_clever", "start_line": 27, "end_line": 27, "excerpt": " right.redeemedAt - left.redeemedAt || (left.id < right.id ? -1 : left.id > right.id ? 1 : 0));", "explanation": "The tie-breaking comparator uses a nested...
fetch-all-pending-push-notifications-scheduled-for-dispatch-within-the-next-ten-minutes-from-the-delivery-queue-js-3aef3e22fb8c
fetch-all-pending-push-notifications-scheduled-for-dispatch-within-the-next-ten-minutes-from-the-delivery-queue
notifications
database-access
Fetch all pending push notifications scheduled for dispatch within the next ten minutes from the delivery queue.
js
import { Op } from 'sequelize'; import { DeliveryQueue } from '../models/delivery-queue.js'; export function fetchPendingPushNotifications(tenantId = process.env.PUSH_TENANT_ID) { return Promise.resolve().then(() => { const tenantKey = typeof tenantId === 'object' ? tenantId.id.valueOf() : tenantId; ...
32
false
false
false
false
false
false
false
false
true
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "unsafe-input-3aef3e22fb8c-l4-l8-7aa8a94d", "flag": "unsafe_input", "start_line": 4, "end_line": 8, "excerpt": "export function fetchPendingPushNotifications(tenantId = process.env.PUSH_TENANT_ID) {", "explanation": "The environment-derived tenant ID is passed through witho...
receive-incoming-webhook-payloads-from-external-calendar-providers-and-update-appointment-status-records-in-the-database-js-f3545acc7963
receive-incoming-webhook-payloads-from-external-calendar-providers-and-update-appointment-status-records-in-the-database
scheduling
http-handler
Receive incoming webhook payloads from external calendar providers and update appointment status records in the database.
js
const { NextResponse } = require('next/server') const { verifyCalendarSignature } = require('@/lib/calendar-crypto') const { findAppointmentByExternalId, updateAppointmentStatus } = require('../../services/appointmentService') async function POST(request) { const rawBody = await request.text() const signature ...
39
false
true
false
false
false
false
false
false
false
false
noise_comments
4
subtle
[]
[ { "finding_slug": "noise-comments-f3545acc7963-l30-l30-7345fe32", "flag": "noise_comments", "start_line": 30, "end_line": 30, "excerpt": " // Locate the appointment linked to the provider event", "explanation": "Restates the immediately following findAppointmentByExternalId call without e...
format-a-numeric-monetary-amount-into-a-localized-currency-string-using-iso-currency-codes-and-user-locale-settings-js-a961e0b1513b
format-a-numeric-monetary-amount-into-a-localized-currency-string-using-iso-currency-codes-and-user-locale-settings
invoicing
utility
Format a numeric monetary amount into a localized currency string using ISO currency codes and user locale settings.
js
function formatMoney(amount, currency, locale = "en-US") { if (typeof amount !== "number" || !Number.isFinite(amount)) { throw new TypeError("Invoice amount must be a finite number") } if (typeof currency !== "string" || !/^[A-Za-z]{3}$/.test(currency)) { throw new TypeError("Invoice currency must be a th...
31
false
true
false
false
false
false
true
false
false
false
duplicated_logic
3
subtle
[]
[ { "finding_slug": "duplicated-logic-a961e0b1513b-l16-l28-d9353b89", "flag": "duplicated_logic", "start_line": 16, "end_line": 28, "excerpt": " if (amount < 0) {", "explanation": "Both paths construct the same currency formatter and format the amount, with the negative path only explicitly s...
develop-a-custom-hook-debouncing-search-term-inputs-and-fetching-autocomplete-product-suggestions-from-the-catalog-api-js-650d95088f45
develop-a-custom-hook-debouncing-search-term-inputs-and-fetching-autocomplete-product-suggestions-from-the-catalog-api
product-catalog
react-hook
Develop a custom hook debouncing search term inputs and fetching autocomplete product suggestions from the catalog API.
js
import { useEffect, useState } from 'react'; export function useProductSuggestions(term) { const query = typeof term === 'string' ? term.trim() : ''; const [state, setState] = useState({ suggestions: [], loading: false, error: null }); useEffect(() => { const controller = new AbortController(); let curre...
21
false
false
false
false
false
true
false
false
false
true
too_clever
2
obvious
[]
[ { "finding_slug": "too-clever-650d95088f45-l9-l17-8007bb8a", "flag": "too_clever", "start_line": 9, "end_line": 17, "excerpt": " const timer = (setState({ suggestions: [], loading: !!query, error: null }), query ? setTimeout(async () => {", "explanation": "The comma expression combines an...
render-a-badge-component-that-displays-current-battery-voltage-and-alternator-health-metrics-for-electric-delivery-trucks-tsx-a6b578f9296e
render-a-badge-component-that-displays-current-battery-voltage-and-alternator-health-metrics-for-electric-delivery-trucks
fleet-tracking
react-component
Render a badge component that displays current battery voltage and alternator health metrics for electric delivery trucks.
tsx
import { forwardRef } from 'react'; interface DeliveryTruckElectricalMetrics { batteryVoltage: number; alternatorStatus: 'OPTIMAL' | 'DEGRADED' | 'FAULT'; } interface FleetElectricalBadgeProps { metrics: DeliveryTruckElectricalMetrics; } const STATUS_STYLES = { OPTIMAL: 'bg-emerald-500/10 text-emerald-700 bord...
29
true
false
true
false
false
false
false
false
false
false
dead_code
3
subtle
[]
[ { "finding_slug": "dead-code-a6b578f9296e-l17-l17-61003f4c", "flag": "dead_code", "start_line": 17, "end_line": 17, "excerpt": " function FleetElectricalBadge({ metrics }, ref) {", "explanation": "The ref parameter is never used or attached to the rendered div, leaving the supplied ref unus...
write-automated-tests-for-the-session-duration-calculator-ensuring-edge-cases-like-idle-timeouts-are-handled-correctly-tsx-803ceaf0b620
write-automated-tests-for-the-session-duration-calculator-ensuring-edge-cases-like-idle-timeouts-are-handled-correctly
analytics
test
Write automated tests for the session duration calculator ensuring edge cases like idle timeouts are handled correctly.
tsx
import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import { calculateSessionDuration } from '../sessionDuration'; const startedAt = Date.parse('2025-03-18T09:00:00.000Z'); const idleTimeoutMs = 300_000; describe('session duration calculator', () => { const cases = [ { ...
53
false
true
false
false
false
false
false
false
false
false
noise_comments
4
subtle
[]
[ { "finding_slug": "noise-comments-803ceaf0b620-l38-l38-0d32a7de", "flag": "noise_comments", "start_line": 38, "end_line": 38, "excerpt": " // Calculate elapsed session time with the idle timeout applied.", "explanation": "The comment redundantly repeats the immediately following calculate...
query-the-relational-store-to-retrieve-all-upcoming-live-lecture-sessions-scheduled-for-a-specific-instructor-id-ts-ed70c5a1115b
query-the-relational-store-to-retrieve-all-upcoming-live-lecture-sessions-scheduled-for-a-specific-instructor-id
course-management
database-access
Query the relational store to retrieve all upcoming live lecture sessions scheduled for a specific instructor ID.
ts
import { PrismaClient } from '@prisma/client'; const prisma = new PrismaClient(); async function loadInstructorSchedule(instructorId: number, boundary: Date) { return await prisma.lectureSession.findMany({ where: { instructorId, status: 'SCHEDULED', format: 'LIVE', startsAt: { gte: boundary }, }, o...
38
false
false
false
false
false
true
false
false
true
false
too_clever
3
borderline
[ "type_safety_hole" ]
[ { "finding_slug": "too-clever-ed70c5a1115b-l26-l30-603ac616", "flag": "too_clever", "start_line": 26, "end_line": 30, "excerpt": "\tconst validatedId = typeof instructorId === 'number'", "explanation": "Nested ternaries turn a validation guard into layered conditional value selection, wherea...
fetch-active-user-session-records-by-token-hash-from-the-postgresql-sessions-table-and-return-expiration-timestamps-ts-50127adc6b02
fetch-active-user-session-records-by-token-hash-from-the-postgresql-sessions-table-and-return-expiration-timestamps
auth
database-access
Fetch active user session records by token hash from the PostgreSQL sessions table and return expiration timestamps
ts
import { Pool } from 'pg'; import Redis from 'ioredis'; import { z } from 'zod'; const tokenHashSchema = z.string().regex(/^[a-f0-9]{64}$/); const sessionRowSchema = z.object({ expires_at: z.date() }).transform( (row, context) => ({ expiresAt: row.expires_at }) ); export async function fetchActiveSessionExpiration(...
39
false
true
true
false
false
false
true
false
false
false
duplicated_logic
3
borderline
[ "dead_code" ]
[ { "finding_slug": "dead-code-50127adc6b02-l7-l7-e3226c7b", "flag": "dead_code", "start_line": 7, "end_line": 7, "excerpt": " (row, context) => ({ expiresAt: row.expires_at })", "explanation": "The transform callback never uses context, so remove the unused parameter.", "audit_verdict": ...
provide-debounced-search-results-for-the-customer-support-lookup-input-by-polling-the-order-history-endpoint-after-user-pauses-typing-js-ed1c9c23bdc1
provide-debounced-search-results-for-the-customer-support-lookup-input-by-polling-the-order-history-endpoint-after-user-pauses-typing
order-management
react-hook
Provide debounced search results for the customer support lookup input by polling the order history endpoint after user pauses typing
js
import { useEffect, useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { z } from "zod"; const orderSchema = z.object({ id: z.string().min(1), status: z.enum(["pending", "shipped", "cancelled"]), placedAt: z.string().datetime(), }); const historySchema = z.object({ openOrders: z.arra...
39
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
check-that-quarterly-federal-unemployment-insurance-tax-calculations-match-the-latest-government-compliance-formulas-jsx-4549ba6b9ce4
check-that-quarterly-federal-unemployment-insurance-tax-calculations-match-the-latest-government-compliance-formulas
payroll
test
Check that quarterly federal unemployment insurance tax calculations match the latest government compliance formulas.
jsx
// @ts-check import { render, screen, within } from '@testing-library/react' import '@testing-library/jest-dom' import { QuarterlyFutaSummary } from '../QuarterlyFutaSummary' const employees = [ { id: 'warehouse-17', payments: [ { paidOn: '2025-12-31', wagesCents: 1000000 }, { paidOn: '2026-01-01', wagesCen...
59
false
true
false
false
false
false
false
false
true
false
type_safety_hole
3
subtle
[]
[ { "finding_slug": "noise-comments-4549ba6b9ce4-l26-l27-ad470e3f", "flag": "noise_comments", "start_line": 26, "end_line": 27, "excerpt": "// Form 940: $7,000 per employee, 6% less the full 5.4% credit.", "explanation": "Lines 26 to 27 explain the Form 940 wage base, credit and Q4 rule in pro...
calculate-total-cost-for-a-stay-duration-including-weekend-surcharges-and-local-tourist-tax-rates-ts-d6e75de4e3cf
calculate-total-cost-for-a-stay-duration-including-weekend-surcharges-and-local-tourist-tax-rates
hotel-booking
utility
Calculate total cost for a stay duration including weekend surcharges and local tourist tax rates.
ts
import { z } from 'zod' const staySchema = z.object({ checkInDate: z.string().date(), checkOutDate: z.string().date(), nightlyRate: z.number().finite().nonnegative(), weekendSurchargeRate: z.number().finite().nonnegative(), touristTaxPerNight: z.number().finite().nonnegative(), currencyCode: z....
44
false
true
false
true
false
false
false
false
false
false
inconsistent_style
4
borderline
[ "over_abstracted" ]
[ { "finding_slug": "inconsistent-style-d6e75de4e3cf-l27-l27-35b798d8", "flag": "inconsistent_style", "start_line": 27, "end_line": 27, "excerpt": " const night_date = new Date(stay.checkInDate)", "explanation": "night_date uses snake_case while the other local variables, including chec...
export-typescript-interfaces-representing-member-tiers-point-ledger-entries-and-active-reward-perks-ts-933ad90033f9
export-typescript-interfaces-representing-member-tiers-point-ledger-entries-and-active-reward-perks
loyalty-rewards
type-definitions
Export TypeScript interfaces representing member tiers, point ledger entries, and active reward perks.
ts
import type { Brand } from './common' import { Logger } from '@nestjs/common' const tierDefaults = JSON.parse('{"minimumPointsRequired":0,"pointEarnMultiplier":1}') as any export type MemberTierLevel = 'bronze' | 'silver' | 'gold' | 'platinum' export interface RewardPerk { readonly id: Brand<string, 'PerkId'> ...
41
false
false
true
false
false
false
false
false
true
false
dead_code
3
subtle
[]
[ { "finding_slug": "dead-code-933ad90033f9-l2-l2-950abf73", "flag": "dead_code", "start_line": 2, "end_line": 2, "excerpt": "import { Logger } from '@nestjs/common'", "explanation": "Logger is never referenced.", "audit_verdict": "valid" }, { "finding_slug": "dead-code-933ad90033f...
provide-debounced-search-results-for-the-customer-support-lookup-input-by-polling-the-order-history-endpoint-after-user-pauses-typing-js-5a38e9b6ce44
provide-debounced-search-results-for-the-customer-support-lookup-input-by-polling-the-order-history-endpoint-after-user-pauses-typing
order-management
react-hook
Provide debounced search results for the customer support lookup input by polling the order history endpoint after user pauses typing
js
import { useEffect, useState } from "react"; import { useQuery } from "@tanstack/react-query"; export function useOrderLookup(search) { const term = search.trim(); const [debouncedTerm, setDebouncedTerm] = useState(""); useEffect(() => { const timer = setTimeout(() => setDebouncedTerm(term), 300); return () => ...
31
false
false
false
false
false
true
false
false
false
true
too_clever
2
obvious
[]
[ { "finding_slug": "unsafe-input-5a38e9b6ce44-l20-l28-3d433776", "flag": "unsafe_input", "start_line": 20, "end_line": 28, "excerpt": "\t\t\tconst history = await response.json();", "explanation": "The API response is consumed without validating its object shape, order arrays, or order fields...
query-the-postgresql-database-to-retrieve-all-cargo-vans-currently-scheduled-for-routine-brake-inspections-this-week-js-6942437b475b
query-the-postgresql-database-to-retrieve-all-cargo-vans-currently-scheduled-for-routine-brake-inspections-this-week
fleet-tracking
database-access
Query the PostgreSQL database to retrieve all cargo vans currently scheduled for routine brake inspections this week.
js
const { z } = require("zod"); const inspectionRows = z.array(z.object({ vin: z.string().min(1), licensePlate: z.string().min(1), mileage: z.number().finite().nonnegative(), inspectionDueDate: z.date() })); function getCargoVansScheduledForBrakeInspectionThisWeek(db, callback) { if (typeof callback !== "func...
45
false
false
false
false
false
true
false
false
false
true
unsafe_input
2
obvious
[]
[ { "finding_slug": "too-clever-6942437b475b-l16-l17-cca193d4", "flag": "too_clever", "start_line": 16, "end_line": 17, "excerpt": " week[1] = new Date((week[0].setUTCHours(0, 0, 0, 0),", "explanation": "The comma operator hides two mutations of the start date inside construction of the end d...
flatten-raw-survey-questionnaire-responses-into-an-average-satisfaction-score-grouped-by-distinct-course-modules-js-e1d01a04d0e1
flatten-raw-survey-questionnaire-responses-into-an-average-satisfaction-score-grouped-by-distinct-course-modules
course-management
data-transform
Flatten raw survey questionnaire responses into an average satisfaction score grouped by distinct course modules.
js
export function mapModuleSatisfaction(payload) { const totals = payload.responses.reduce((modules, response) => ( response.answers.forEach(({ moduleId, satisfaction }) => { const tally = modules.get(moduleId) ?? [0, 0]; modules.set(moduleId, (tally[0] += satisfaction, tally[1]++, tal...
15
false
false
false
false
false
true
false
false
false
false
too_clever
3
obvious
[]
[ { "finding_slug": "too-clever-e1d01a04d0e1-l2-l7-dfbac13e", "flag": "too_clever", "start_line": 2, "end_line": 7, "excerpt": " const totals = payload.responses.reduce((modules, response) => (", "explanation": "The reducer uses a comma expression to run a nested mutation loop and then retu...
implement-a-redux-slice-to-track-active-mortgage-application-steps-persisting-current-draft-values-across-browser-refreshes-js-e66001a8f73f
implement-a-redux-slice-to-track-active-mortgage-application-steps-persisting-current-draft-values-across-browser-refreshes
banking
state-management
Implement a Redux slice to track active mortgage application steps, persisting current draft values across browser refreshes.
js
import { createContext, createElement, useContext, useEffect, useReducer } from "react"; import { createSlice } from "@reduxjs/toolkit"; import { z } from "zod"; const storageKey = "mortgage-application:v1"; const MortgageContext = createContext(null); const steps = z.enum(["applicant", "property", "finances", "review...
66
false
false
false
false
false
false
true
false
false
false
duplicated_logic
3
subtle
[]
[ { "finding_slug": "duplicated-logic-e66001a8f73f-l25-l32-425ddcc0", "flag": "duplicated_logic", "start_line": 25, "end_line": 32, "excerpt": "\treturn z.object({", "explanation": "Restoration rebuilds the step enum and draft validation already defined in steps and draftSchema, which reusing ...
sanitize-user-provided-html-strings-in-support-message-bodies-to-strip-out-dangerous-script-tags-while-preserving-safe-formatting-elements-ts-90405d8e0f7e
sanitize-user-provided-html-strings-in-support-message-bodies-to-strip-out-dangerous-script-tags-while-preserving-safe-formatting-elements
customer-support
utility
Sanitize user-provided HTML strings in support message bodies to strip out dangerous script tags while preserving safe formatting elements.
ts
import _ from 'lodash'; import sanitizeHtml from 'sanitize-html'; export interface SupportMessagePayload { ticketId: string; authorEmail: string; rawBody: string; } export interface CleanedSupportMessage { ticketId: string; authorEmail: string; processedBody: string; } export async function cleanSupportM...
45
true
false
false
false
false
false
false
false
true
false
unclear_naming
3
borderline
[ "type_safety_hole" ]
[ { "finding_slug": "type-safety-hole-90405d8e0f7e-l17-l17-709ed154", "flag": "type_safety_hole", "start_line": 17, "end_line": 17, "excerpt": " const t = rawBody as string;", "explanation": "This asserts that the unknown rawBody is a string before checking it, and although the following runt...
aggregate-monthly-commercial-checking-account-deposits-by-industry-sector-to-generate-quarterly-liquidity-risk-assessment-matrices-ts-213901ac448f
aggregate-monthly-commercial-checking-account-deposits-by-industry-sector-to-generate-quarterly-liquidity-risk-assessment-matrices
banking
data-transform
Aggregate monthly commercial checking account deposits by industry sector to generate quarterly liquidity risk assessment matrices.
ts
import { z } from 'zod' const monthlyStatementSchema = z.array(z.object({ month: z.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/), sector: z.string().min(1), deposits: z.unknown() })) type LiquidityRow = { quarter: string sector: string monthlyDeposits: number[] } export function buildLiquidityMatrix(payload:...
37
false
false
false
false
false
false
false
false
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "unsafe-input-213901ac448f-l28-l28-4743a94c", "flag": "unsafe_input", "start_line": 28, "end_line": 28, "excerpt": " row.monthlyDeposits[monthOffset % 3] += Number(statement.deposits)", "explanation": "The schema accepts deposits as z.unknown(), so parsing does not valid...
execute-nightly-reconciliation-queries-to-flag-shipments-missing-final-proof-of-delivery-signatures-js-55a0c243ae7e
execute-nightly-reconciliation-queries-to-flag-shipments-missing-final-proof-of-delivery-signatures
shipping
async-job
Execute nightly reconciliation queries to flag shipments missing final proof of delivery signatures
js
import { z } from "zod"; const payloadSchema = z.object({ day: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).refine((day) => { const timestamp = Date.parse(`${day}T00:00:00.000Z`); return Number.isFinite(timestamp) && new Date(timestamp).toISOString().slice(0, 10) === day; }, "Expected a ...
49
false
false
false
true
true
false
false
false
false
false
over_abstracted
3
borderline
[ "over_abstracted" ]
[ { "finding_slug": "over-abstracted-55a0c243ae7e-l31-l37-4bad7ed2", "flag": "over_abstracted", "start_line": 31, "end_line": 37, "excerpt": "function createReconciliationRepository(db) {", "explanation": "This single-use factory creates an object whose only method forwards to db.query with fi...
format-total-ticket-prices-into-local-currency-strings-with-explicit-tax-and-service-fee-breakdowns-js-1c013f8a84b5
format-total-ticket-prices-into-local-currency-strings-with-explicit-tax-and-service-fee-breakdowns
event-ticketing
utility
Format total ticket prices into local currency strings with explicit tax and service fee breakdowns.
js
import { z } from 'zod'; const amount = z.number().finite().min(0).max(1e12); const quoteSchema = z.object({ subtotal: amount, tax: amount, serviceFee: amount, locale: z.string().min(1), currency: z.string().regex(/^[A-Z]{3}$/), quotedAt: z.string().datetime({ offset: true }), }); export function formatTi...
34
false
false
false
false
false
false
true
false
false
false
duplicated_logic
4
subtle
[]
[ { "finding_slug": "duplicated-logic-1c013f8a84b5-l24-l27-b5001f43", "flag": "duplicated_logic", "start_line": 24, "end_line": 27, "excerpt": " const total = new Intl.NumberFormat(quote.locale, {", "explanation": "The total repeats the currency formatter construction and configuration from l...
synchronize-user-timezone-changes-with-the-server-and-debounce-automatic-preference-persistence-calls-ts-367e15661530
synchronize-user-timezone-changes-with-the-server-and-debounce-automatic-preference-persistence-calls
user-profiles
react-hook
Synchronize user timezone changes with the server and debounce automatic preference persistence calls.
ts
import { useEffect, useState } from "react"; export function useTimezoneSync(userId: string, currentTimezone: string): void { const [failure, setFailure] = useState<Error | null>(null); useEffect(() => { let active = true; const timer = setTimeout(async () => { try { if (!userId.trim() || !cu...
26
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
process-a-supervisor-approval-submission-for-a-travel-report-update-its-status-to-cleared-and-trigger-a-notification-email-js-cf663aa0580c
process-a-supervisor-approval-submission-for-a-travel-report-update-its-status-to-cleared-and-trigger-a-notification-email
expense-reports
server-action
Process a supervisor approval submission for a travel report, update its status to cleared, and trigger a notification email.
js
'use server'; import { z } from 'zod'; import { db } from '@/server/db'; import { requireSupervisor } from '@/server/auth'; import { sendTravelReportCleared } from '@/server/mail'; const approvalSchema = z.object({ reportId: z.string().uuid(), approvalNote: z.string().trim().max(2000).default(''), }).strict(); e...
60
false
true
false
false
false
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "noise-comments-cf663aa0580c-l21-l21-9dd2b936", "flag": "noise_comments", "start_line": 21, "end_line": 21, "excerpt": " // Clear the submitted report assigned to this supervisor.", "explanation": "This restates the immediately following status update and superviso...
process-the-nightly-queue-worker-dispatching-reminder-emails-for-assignments-due-within-the-next-twenty-four-hours-js-c9ca3f8882a6
process-the-nightly-queue-worker-dispatching-reminder-emails-for-assignments-due-within-the-next-twenty-four-hours
course-management
async-job
Process the nightly queue worker dispatching reminder emails for assignments due within the next twenty-four hours.
js
const cron = require('node-cron') const { z } = require('zod') const db = require('./db') const mailer = require('./mailer') const assignmentsSchema = z.array(z.object({ id: z.number().int().positive(), student_email: z.string().email(), course_title: z.string().min(1), due_date: z.date() })) class ReminderQue...
54
false
false
false
false
true
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "over-abstracted-c9ca3f8882a6-l12-l16-1ba86ce0", "flag": "over_abstracted", "start_line": 12, "end_line": 16, "excerpt": "class ReminderQueryBuilder {", "explanation": "This class builds nothing variable because its only method returns a fixed SQL string, so a query constan...
process-the-submitted-campaign-creation-form-payload-and-persist-the-new-scheduled-dispatch-ts-26af74c010f7
process-the-submitted-campaign-creation-form-payload-and-persist-the-new-scheduled-dispatch
email-campaigns
server-action
Process the submitted campaign creation form payload and persist the new scheduled dispatch.
ts
'use server'; import { revalidatePath } from 'next/cache'; import { redirect } from 'next/navigation'; import { db } from '@/lib/database'; import { emailCampaignsTable } from '@/lib/database/schema'; import { requireAuthenticatedUser } from '@/lib/auth/session'; export async function createScheduledCampaignDispatch(...
37
false
false
true
false
false
false
false
false
false
true
unsafe_input
2
obvious
[]
[ { "finding_slug": "unsafe-input-26af74c010f7-l11-l15-bdcf9ec8", "flag": "unsafe_input", "start_line": 11, "end_line": 15, "excerpt": " const campaignTitle = String(formData.get('campaignTitle') ?? '');", "explanation": "Submitted fields are coerced to strings and persisted without validat...
attach-input-mask-and-real-time-validation-to-credit-card-number-and-expiry-fields-in-checkout-form-ts-4de115bfab04
attach-input-mask-and-real-time-validation-to-credit-card-number-and-expiry-fields-in-checkout-form
hotel-booking
dom-code
Attach input mask and real-time validation to credit card number and expiry fields in checkout form.
ts
export async function attachCardValidation(form: HTMLFormElement): Promise<void> { const legacySeparator = '-' try { // Fetch the card rules const response = await fetch('/api/checkout/card-rules') if (!response.ok) throw new Error(`Card rules: HTTP ${response.status}`) const rul...
41
false
true
true
false
false
false
false
true
false
false
error_handling_problem
2
obvious
[]
[ { "finding_slug": "dead-code-4de115bfab04-l2-l2-c4a32471", "flag": "dead_code", "start_line": 2, "end_line": 2, "excerpt": " const legacySeparator = '-'", "explanation": "legacySeparator is never referenced.", "audit_verdict": "valid" }, { "finding_slug": "noise-comments-4de11...
process-incoming-webhook-payloads-from-the-payment-gateway-to-activate-student-access-upon-invoice-settlement-ts-12e1a239365c
process-incoming-webhook-payloads-from-the-payment-gateway-to-activate-student-access-upon-invoice-settlement
course-management
http-handler
Process incoming webhook payloads from the payment gateway to activate student access upon invoice settlement.
ts
import { Request, Response } from "express" import Stripe from "stripe" import { z } from "zod" import { enrollStudentInCourse } from "../services/enrollmentService" const credentials = z.object({ STRIPE_WEBHOOK_SECRET: z.string().regex(/^whsec_\S+$/) }).parse(process.env) const stripe = new Stripe(process.env.STRIP...
49
false
false
false
false
true
false
false
false
false
true
over_abstracted
3
subtle
[]
[ { "finding_slug": "unsafe-input-12e1a239365c-l9-l9-2bbbcb44", "flag": "unsafe_input", "start_line": 9, "end_line": 9, "excerpt": "const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? \"\")", "explanation": "The Stripe API key is read from the environment without validation because the ...
run-a-terminal-script-to-purge-resolved-notification-logs-older-than-ninety-days-from-the-database-js-c6720953ae9a
run-a-terminal-script-to-purge-resolved-notification-logs-older-than-ninety-days-from-the-database
project-management
cli-script
Run a terminal script to purge resolved notification logs older than ninety days from the database.
js
import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; import { databasePool } from '../services/database.js'; import { logger } from '../utils/logger.js'; function createRetentionCommand(retentionPolicy, deletionStrategy) { return async () => { const cutoffDate = retentionPolicy(); const result...
38
false
false
false
false
true
false
false
true
false
false
over_abstracted
3
subtle
[]
[ { "finding_slug": "over-abstracted-c6720953ae9a-l6-l23-25d9a569", "flag": "over_abstracted", "start_line": 6, "end_line": 23, "excerpt": "function createRetentionCommand(retentionPolicy, deletionStrategy) {", "explanation": "A configurable command factory with retention-policy and deletion-s...
export-typescript-interfaces-representing-upload-progress-events-error-metadata-objects-and-configuration-properties-ts-808fac3f3ed2
export-typescript-interfaces-representing-upload-progress-events-error-metadata-objects-and-configuration-properties
file-uploads
type-definitions
Export TypeScript interfaces representing upload progress events, error metadata objects, and configuration properties.
ts
import { ApiClientError } from '@api/errors' export type UploadStatus = 'pending' | 'uploading' | 'completed' | 'failed' function progressSnapshot( fileId: string, transfers: ReadonlyMap<string, { loadedBytes: number, totalBytes: number }>, status: UploadStatus ) { if (!transfers.has(fileId)) throw new Error(...
36
false
false
false
false
false
false
true
false
true
false
duplicated_logic
3
borderline
[ "type_safety_hole" ]
[ { "finding_slug": "type-safety-hole-808fac3f3ed2-l11-l11-82df8527", "flag": "type_safety_hole", "start_line": 11, "end_line": 11, "excerpt": " const transfer = transfers.get(fileId)!", "explanation": "The non-null assertion bypasses the check on the value returned by Map.get, and although t...
process-background-queue-jobs-that-sync-updated-inventory-quantities-to-the-elasticsearch-search-cluster-js-27499ba74099
process-background-queue-jobs-that-sync-updated-inventory-quantities-to-the-elasticsearch-search-cluster
search
async-job
Process background queue jobs that sync updated inventory quantities to the elasticsearch search cluster.
js
import { Client } from "@elastic/elasticsearch"; import { z } from "zod"; const endpoint = z.string().url().refine((value) => { const url = new URL(value); return url.protocol === "https:" && !url.username && !url.password; }).parse(process.env.ELASTICSEARCH_URL); const search = new Client({ node: endpoint }); con...
31
false
false
false
false
false
true
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "too-clever-27499ba74099-l21-l26-60810ade", "flag": "too_clever", "start_line": 21, "end_line": 26, "excerpt": " await search.update(Object.fromEntries([", "explanation": "Building a fixed Elasticsearch request by enumerating payload fields, conditionally renaming them, ...
build-a-variant-selector-card-rendering-color-swatches-size-buttons-and-out-of-stock-overlay-indicators-for-selected-items-tsx-879f4af491e6
build-a-variant-selector-card-rendering-color-swatches-size-buttons-and-out-of-stock-overlay-indicators-for-selected-items
product-catalog
react-component
Build a variant selector card rendering color swatches, size buttons, and out-of-stock overlay indicators for selected items.
tsx
import { useQuery } from "@tanstack/react-query"; import { z } from "zod"; const variantsSchema = z.array(z.object({ id: z.string().min(1), colorName: z.string().min(1), colorHex: z.string().regex(/^#[0-9a-fA-F]{6}$/), size: z.string().min(1), inStock: z.boolean(), })); interface VariantSelectorProps { productId: ...
46
false
false
false
false
false
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "error-handling-problem-879f4af491e6-l23-l25-d854c126", "flag": "error_handling_problem", "start_line": 23, "end_line": 25, "excerpt": "\t\t\t} catch {", "explanation": "Network, HTTP, JSON, and schema errors are all converted into a successful empty array, preventing React...
process-incoming-webhook-payloads-from-external-pos-systems-and-credit-purchase-points-to-customer-profiles-ts-ad0f010d3ecd
process-incoming-webhook-payloads-from-external-pos-systems-and-credit-purchase-points-to-customer-profiles
loyalty-rewards
http-handler
Process incoming webhook payloads from external POS systems and credit purchase points to customer profiles.
ts
import type { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'; import { z } from 'zod'; import { creditPurchase } from './rewards/ledger.js'; const purchaseSchema = z.object({ transactionId: z.string().uuid(), storeId: z.string().uuid(), customerId: z.string().uuid(), amountCents: z.num...
46
false
true
false
false
false
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "noise-comments-ad0f010d3ecd-l30-l30-773b8457", "flag": "noise_comments", "start_line": 30, "end_line": 30, "excerpt": " // Award one purchase point per whole dollar.", "explanation": "This comment restates the point calculation on the next line.", "audit_verdict": "...
purge-orphaned-draft-attachments-from-object-storage-that-have-unreferenced-asset-identifiers-ts-1b0d24c25065
purge-orphaned-draft-attachments-from-object-storage-that-have-unreferenced-asset-identifiers
content-publishing
cli-script
Purge orphaned draft attachments from object storage that have unreferenced asset identifiers.
ts
import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; import { z } from 'zod'; import { createDatabasePool } from './database.js'; import { deleteObjectBatch } from './objectStorage.js'; const attachmentRows = z.array(z.object({ storage_key: z.string().min(1) })); yargs(hideBin(process.argv)) .command(...
27
false
false
false
false
false
false
false
false
false
true
unsafe_input
1
subtle
[]
[ { "finding_slug": "unsafe-input-1b0d24c25065-l14-l16-0015316b", "flag": "unsafe_input", "start_line": 14, "end_line": 16, "excerpt": " WHERE d.publication_id = '${argv.publicationId}' AND NOT EXISTS (", "explanation": "The CLI publication identifier is interpolated directly into SQL wit...
process-incoming-webhook-payloads-from-github-to-automatically-update-linked-task-statuses-when-a-pull-request-merges-js-e007d25f8b89
process-incoming-webhook-payloads-from-github-to-automatically-update-linked-task-statuses-when-a-pull-request-merges
project-management
async-job
Process incoming webhook payloads from GitHub to automatically update linked task statuses when a pull request merges.
js
import cron from 'node-cron'; import { z } from 'zod'; const webhookSchema = z.object({ event: z.string().min(1), payload: z.object({ action: z.string().min(1), repository: z.object({ full_name: z.string().regex(/^[\w.-]+\/[\w.-]+$/), }), pull_request: z.object({ number: z.number().int(...
44
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
purge-soft-deleted-feedback-records-older-than-ninety-days-from-the-database-during-nightly-maintenance-windows-js-683e3efb47fd
purge-soft-deleted-feedback-records-older-than-ninety-days-from-the-database-during-nightly-maintenance-windows
reviews
cli-script
Purge soft-deleted feedback records older than ninety days from the database during nightly maintenance windows.
js
const { Pool } = require('pg'); const yargs = require('yargs/yargs'); const { hideBin } = require('yargs/helpers'); async function runPurge() { const connectionString = process.env.DATABASE_URL; if (typeof connectionString !== 'string' || !connectionString.trim()) { throw new Error('DATABASE_URL is req...
54
true
false
false
false
false
false
false
false
false
false
unclear_naming
4
subtle
[]
[ { "finding_slug": "unclear-naming-683e3efb47fd-l19-l19-3bb17eb8", "flag": "unclear_naming", "start_line": 19, "end_line": 19, "excerpt": " const value = new Date(maintenanceStartedAt.getTime() - 90 * 24 * 60 * 60 * 1000);", "explanation": "The name value does not communicate that this dat...
format-duration-in-minutes-into-a-human-readable-string-like-two-hours-and-fifteen-minutes-ts-8917c70b9219
format-duration-in-minutes-into-a-human-readable-string-like-two-hours-and-fifteen-minutes
time-tracking
utility
Format duration in minutes into a human-readable string like two hours and fifteen minutes.
ts
const a: any = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']; const b: any = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']; function ...
34
true
false
false
false
false
false
false
false
true
false
unclear_naming
2
obvious
[]
[ { "finding_slug": "type-safety-hole-8917c70b9219-l1-l1-74d5b40b", "flag": "type_safety_hole", "start_line": 1, "end_line": 1, "excerpt": "const a: any = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', ...
submit-a-weekly-timesheet-for-managerial-approval-and-lock-all-included-entries-against-further-edits-js-6e0d9ee3271d
submit-a-weekly-timesheet-for-managerial-approval-and-lock-all-included-entries-against-further-edits
time-tracking
server-action
Submit a weekly timesheet for managerial approval and lock all included entries against further edits.
js
const { redirect } = require('@remix-run/node'); const { db } = require('~/utils/db.server'); const { requireUserSession } = require('~/utils/session.server'); function action({ request }) { return requireUserSession(request).then(function (sessionUser) { return request.formData().then(function (formData) ...
24
false
false
false
false
false
false
false
true
false
true
error_handling_problem
2
obvious
[]
[ { "finding_slug": "unsafe-input-6e0d9ee3271d-l8-l10-cededccb", "flag": "unsafe_input", "start_line": 8, "end_line": 10, "excerpt": " const timesheetId = String(formData.get('timesheetId'));", "explanation": "The external form value is coerced rather than validated before use as a ...
define-typescript-interfaces-representing-customer-billing-profiles-payment-methods-and-tiered-subscription-contracts-ts-ab36a88ea8d8
define-typescript-interfaces-representing-customer-billing-profiles-payment-methods-and-tiered-subscription-contracts
subscription-billing
type-definitions
Define TypeScript interfaces representing customer billing profiles, payment methods, and tiered subscription contracts.
ts
export enum BillingCycle { Monthly = 'MONTHLY', Annual = 'ANNUAL', } export enum PaymentMethodType { Card = 'CARD', BankTransfer = 'BANK_TRANSFER', } type BillingMethodAdapter<Method> = { [Field in keyof Method]: Method[Field]; }; type Limit = number; export interface CardPaymentMethod { id: string; typ...
50
false
false
false
false
true
false
false
false
false
false
over_abstracted
4
subtle
[]
[ { "finding_slug": "over-abstracted-ab36a88ea8d8-l10-l12-54798464", "flag": "over_abstracted", "start_line": 10, "end_line": 12, "excerpt": "type BillingMethodAdapter<Method> = {", "explanation": "The generic identity mapped type BillingMethodAdapter is used only to re-express the payment-met...
map-raw-checkout-line-items-into-structured-payloads-required-by-the-external-tax-calculation-service-api-js-0768607d6994
map-raw-checkout-line-items-into-structured-payloads-required-by-the-external-tax-calculation-service-api
shopping-cart
data-transform
Map raw checkout line items into structured payloads required by the external tax calculation service API
js
import { z } from "zod" import { TaxProviderClient } from "@external/tax-service" const cartSchema = z.object({ customerId: z.string().min(1), currency: z.union([z.string().regex(/^[A-Z]{3}$/), z.literal("")]).nullish(), shippingAddress: z.object({ country: z.union([z.string().regex(/^[A-Z]{2}$/), z.literal(...
44
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
check-that-joint-checking-accounts-correctly-reject-withdrawal-transactions-exceeding-the-combined-available-daily-limit-js-876c8e9ca7d8
check-that-joint-checking-accounts-correctly-reject-withdrawal-transactions-exceeding-the-combined-available-daily-limit
banking
test
Check that joint checking accounts correctly reject withdrawal transactions exceeding the combined available daily limit.
js
const request = require('supertest'); const app = require('../../../src/app'); const { ACCOUNT_TYPES } = require('../../../src/constants/banking'); describe('POST /api/v1/accounts/joint/withdrawal', () => { const accountId = 'acc_joint_55443322'; const holderIds = ['usr_8829103847', 'usr_9938201928']; var ...
39
false
false
false
true
false
false
false
false
false
false
inconsistent_style
3
subtle
[]
[ { "finding_slug": "inconsistent-style-876c8e9ca7d8-l8-l8-3c900722", "flag": "inconsistent_style", "start_line": 8, "end_line": 8, "excerpt": " var authorizationHeader = 'Bearer test_token_joint_auth';", "explanation": "The unchanged authorizationHeader is declared with var while the other...
query-the-properties-table-for-active-listings-matching-specified-postal-codes-and-minimum-square-footage-js-c3a02d1f9603
query-the-properties-table-for-active-listings-matching-specified-postal-codes-and-minimum-square-footage
property-listings
database-access
Query the properties table for active listings matching specified postal codes and minimum square footage.
js
const { and, eq, inArray, gte } = require('drizzle-orm'); const { db } = require('../db'); const { properties } = require('../db/schema'); async function getListingsByPostalAndSize(postalCodes, minSquareFootage) { if (!Array.isArray(postalCodes) || postalCodes.length === 0) { throw new TypeError('Postal codes must ...
35
false
false
false
false
false
true
true
true
false
false
error_handling_problem
2
obvious
[]
[ { "finding_slug": "duplicated-logic-c3a02d1f9603-l10-l13-0ec31c8d", "flag": "duplicated_logic", "start_line": 10, "end_line": 13, "excerpt": "\t\tif (typeof code !== 'string' || !code.trim()) {", "explanation": "Postal-code validation and normalization are repeated at lines 25 to 28, so extr...
manage-paginated-time-off-request-fetching-with-automatic-caching-and-optimistic-approval-updates-ts-72596aaef7ac
manage-paginated-time-off-request-fetching-with-automatic-caching-and-optimistic-approval-updates
payroll
react-hook
Manage paginated time-off request fetching with automatic caching and optimistic approval updates.
ts
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { z } from 'zod'; const requestSchema = z.object({ id: z.string().uuid(), employeeId: z.string().uuid(), startDate: z.string().date(), endDate: z.string().date(), status: z.enum(['pending', 'approved', 'rejected']), }).refine((...
47
false
true
false
false
false
false
false
true
false
false
error_handling_problem
2
borderline
[ "dead_code" ]
[ { "finding_slug": "noise-comments-72596aaef7ac-l14-l14-7e17df53", "flag": "noise_comments", "start_line": 14, "end_line": 14, "excerpt": " // Get the query client.", "explanation": "Restates the immediately following useQueryClient call without adding rationale.", "audit_verdict": "vali...
create-a-custom-hook-that-debounces-search-input-values-and-manages-request-cancellation-tokens-ts-9660dedb0438
create-a-custom-hook-that-debounces-search-input-values-and-manages-request-cancellation-tokens
search
react-hook
Create a custom hook that debounces search input values and manages request cancellation tokens.
ts
import { useEffect, useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { z } from "zod"; const DEFAULT_PAGE_SIZE = 20; const searchResultsSchema = z.array(z.object({ id: z.string().min(1), title: z.string(), snippet: z.string(), })); export function useDebouncedSearch(rawInput: string...
37
false
false
true
false
false
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "dead-code-9660dedb0438-l5-l5-394a7520", "flag": "dead_code", "start_line": 5, "end_line": 5, "excerpt": "const DEFAULT_PAGE_SIZE = 20;", "explanation": "The local constant DEFAULT_PAGE_SIZE is never referenced and should be removed rather than left as an unused pagination ...
format-volumetric-weight-calculations-using-standard-dimensional-divisor-formulas-for-international-cargo-js-ae6d3dd307ca
format-volumetric-weight-calculations-using-standard-dimensional-divisor-formulas-for-international-cargo
shipping
utility
Format volumetric weight calculations using standard dimensional divisor formulas for international cargo
js
class CargoDivisorFactory { create(unitSystem) { return unitSystem === 'imperial' ? 139 : 5000; } } export class VolumetricCalculator { async calculateCubicWeight(length, width, height, unitSystem = 'metric') { if (!['metric', 'domestic', 'imperial'].includes(unitSystem)) { throw new RangeError('Un...
26
false
true
false
false
true
false
false
false
false
false
over_abstracted
3
obvious
[]
[ { "finding_slug": "over-abstracted-ae6d3dd307ca-l1-l5-304c766c", "flag": "over_abstracted", "start_line": 1, "end_line": 5, "excerpt": "class CargoDivisorFactory {", "explanation": "A factory class instantiated solely to select between two numeric constants adds unnecessary structure; select...
process-domestic-return-label-generation-requests-by-validating-package-dimensions-and-calling-postal-carrier-apis-js-cd2d1b8a5684
process-domestic-return-label-generation-requests-by-validating-package-dimensions-and-calling-postal-carrier-apis
shipping
server-action
Process domestic return label generation requests by validating package dimensions and calling postal carrier APIs
js
import { json } from "@remix-run/node" import { z } from "zod" import { createPostalReturnLabel } from "~/services/postal.server" const dimension = z.number().finite().positive().max(36) const returnRequest = z.object({ returnId: z.string().uuid(), country: z.literal("US"), package: z.object({ lengthInches: ...
51
false
false
true
false
false
false
false
false
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "dead-code-cd2d1b8a5684-l22-l25-f8376f18", "flag": "dead_code", "start_line": 22, "end_line": 25, "excerpt": "function estimateCubicFeet(parcel) {", "explanation": "The non-exported estimateCubicFeet helper has no references, so remove it rather than maintaining an unused v...
receive-incoming-webhook-http-payloads-from-third-party-identity-providers-and-write-raw-authentication-audit-events-to-storage-js-cfbdc84859ee
receive-incoming-webhook-http-payloads-from-third-party-identity-providers-and-write-raw-authentication-audit-events-to-storage
audit-logging
http-handler
Receive incoming webhook HTTP payloads from third-party identity providers and write raw authentication audit events to storage.
js
import { verifyWebhookSignature } from '../services/crypto.js'; import { insertAuditLogRecord } from '../services/auditStorage.js'; export async function handleIdentityProviderWebhook(req, res, next) { try { const signature = req.headers['x-provider-signature']; if (typeof signature !== 'string' || !Buffer.i...
29
false
false
false
false
false
true
false
false
true
true
unsafe_input
2
obvious
[]
[ { "finding_slug": "unsafe-input-cfbdc84859ee-l14-l24-08bea59a", "flag": "unsafe_input", "start_line": 14, "end_line": 24, "excerpt": " const payload = req.body;", "explanation": "The external request body is written to storage without validating its event fields or timestamp, because sign...
map-raw-checkout-line-items-into-structured-payloads-required-by-the-external-tax-calculation-service-api-js-cebfddf41032
map-raw-checkout-line-items-into-structured-payloads-required-by-the-external-tax-calculation-service-api
shopping-cart
data-transform
Map raw checkout line items into structured payloads required by the external tax calculation service API
js
import { z } from "zod" import { TaxProviderClient } from "@external/tax-service" const cartSchema = z.object({ customerId: z.string().min(1), currency: z.union([z.string().regex(/^[A-Z]{3}$/), z.literal("")]).nullish(), shippingAddress: z.object({ country: z.union([z.string().regex(/^[A-Z]{2}$/), z.literal(...
50
true
false
false
false
false
false
true
false
false
false
duplicated_logic
3
subtle
[]
[ { "finding_slug": "unclear-naming-cebfddf41032-l21-l21-7be154d4", "flag": "unclear_naming", "start_line": 21, "end_line": 21, "excerpt": " const basis = new Map()", "explanation": "The name basis does not identify that this map stores monetary totals keyed by product category, whereas cat...
manage-the-draft-state-of-a-purchase-order-line-item-form-with-automatic-local-persistence-and-validation-triggers-ts-c109dda35c82
manage-the-draft-state-of-a-purchase-order-line-item-form-with-automatic-local-persistence-and-validation-triggers
procurement
react-hook
Manage the draft state of a purchase order line-item form with automatic local persistence and validation triggers.
ts
import { useEffect, useState } from 'react'; import { z } from 'zod'; const draftSchema = z.object({ sku: z.string(), quantity: z.number().finite(), unitPrice: z.number().finite(), costCenterCode: z.string(), deliveryNotes: z.string(), }).strict(); const submissionSchema = draftSchema.extend({ sku: z.strin...
69
false
true
false
false
false
false
false
true
false
false
error_handling_problem
3
subtle
[]
[ { "finding_slug": "error-handling-problem-c109dda35c82-l43-l45-f936bb6e", "flag": "error_handling_problem", "start_line": 43, "end_line": 45, "excerpt": " } catch {", "explanation": "Persistence failures are silently discarded, so although keeping editing available is reasonable, callers ...
query-historical-salary-adjustments-and-promotion-dates-for-a-given-employee-identification-number-ts-4fa4fb9fe21b
query-historical-salary-adjustments-and-promotion-dates-for-a-given-employee-identification-number
payroll
database-access
Query historical salary adjustments and promotion dates for a given employee identification number.
ts
import { eq } from "drizzle-orm"; import { db } from "../db"; import { salaryAdjustmentsTable, promotionsTable } from "../schema/payroll"; export type EmployeeHistoryResult = { employeeId: string; salaryAdjustments: Array<typeof salaryAdjustmentsTable.$inferSelect>; promotions: Array<typeof promotionsTable...
38
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
synchronize-user-timezone-changes-with-the-server-and-debounce-automatic-preference-persistence-calls-ts-906c251e31ec
synchronize-user-timezone-changes-with-the-server-and-debounce-automatic-preference-persistence-calls
user-profiles
react-hook
Synchronize user timezone changes with the server and debounce automatic preference persistence calls.
ts
import { useEffect, useState } from "react"; export function useTimezoneSync(userId: string, currentTimezone: string): void { const [syncError, setSyncError] = useState<Error | null>(null); useEffect(() => { let ready = true; async function handle() { try { if (!userId.trim() || !currentTimez...
30
true
false
false
false
false
false
false
false
false
false
unclear_naming
4
subtle
[]
[ { "finding_slug": "unclear-naming-906c251e31ec-l6-l6-52f82c53", "flag": "unclear_naming", "start_line": 6, "end_line": 6, "excerpt": " let ready = true;", "explanation": "The name ready suggests initialization readiness rather than whether this effect is still active and may report errors...
export-typescript-interfaces-for-cart-item-models-discount-structures-and-shipping-address-parameters-ts-21bd0ac45b3d
export-typescript-interfaces-for-cart-item-models-discount-structures-and-shipping-address-parameters
shopping-cart
type-definitions
Export TypeScript interfaces for cart item models, discount structures, and shipping address parameters
ts
export interface PercentageDiscount { kind: "percentage" basisPoints: number } export interface FixedDiscount { kind: "fixed" amountCents: number } export type Discount = PercentageDiscount | FixedDiscount type ItemFields = { [K in "sku" | "title" | "quantity" | "unitPriceCents" | "discounts"]: K extends...
32
false
false
false
false
true
true
false
false
false
false
too_clever
3
subtle
[]
[ { "finding_slug": "too-clever-21bd0ac45b3d-l12-l14-3aff72f3", "flag": "too_clever", "start_line": 12, "end_line": 14, "excerpt": " [K in \"sku\" | \"title\" | \"quantity\" | \"unitPriceCents\" | \"discounts\"]:", "explanation": "Nested conditional types make readers evaluate a type-level de...
implement-a-redux-slice-to-track-selected-purchase-order-filters-search-queries-and-pagination-parameters-ts-ed7839cc46d2
implement-a-redux-slice-to-track-selected-purchase-order-filters-search-queries-and-pagination-parameters
procurement
state-management
Implement a Redux slice to track selected purchase order filters, search queries, and pagination parameters.
ts
export type ProcurementFilterState = { searchQuery: string selectedVendorId: string | null pageNumber: number rowsPerPage: number } type ProcurementAction = | { type: 'SET_SEARCH'; payload: string } | { type: 'SET_VENDOR'; payload: string | null } | { type: 'SET_PAGE'; payload: number } | { type: 'SET_...
63
false
false
false
false
false
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "error-handling-problem-ed7839cc46d2-l60-l62-292e33e2", "flag": "error_handling_problem", "start_line": 60, "end_line": 62, "excerpt": " } catch {", "explanation": "The catch block catches every reducer exception, including the deliberately thrown rows-per-page RangeError,...
process-incoming-post-requests-at-the-evaluation-api-route-to-resolve-all-requested-feature-flags-for-a-given-user-ts-a03478f83620
process-incoming-post-requests-at-the-evaluation-api-route-to-resolve-all-requested-feature-flags-for-a-given-user
feature-flags
http-handler
Process incoming POST requests at the evaluation API route to resolve all requested feature flags for a given user.
ts
import type { NextApiRequest, NextApiResponse } from "next"; import { evaluateFlagRules } from "@lib/feature-flags/engine"; import { validateEvaluationPayload } from "@lib/feature-flags/validation"; import type { EvaluationContext, EvaluationResult } from "@lib/feature-flags/types"; const DEFAULT_TIMEOUT_MS = 3000; t...
41
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
draft-a-command-line-script-importing-csv-catalog-feeds-and-upserting-product-records-into-the-primary-database-cluster-ts-898c8803e079
draft-a-command-line-script-importing-csv-catalog-feeds-and-upserting-product-records-into-the-primary-database-cluster
product-catalog
cli-script
Draft a command-line script importing CSV catalog feeds and upserting product records into the primary database cluster.
ts
import { readFile, stat } from "node:fs/promises"; import { resolve } from "node:path"; import { createInterface } from "node:readline/promises"; import { parse } from "csv-parse/sync"; import { z } from "zod"; import { databaseClusterPool } from "../infrastructure/database.js"; const feedPath = z.string().trim().min(...
41
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
query-postgresql-for-available-rooms-matching-capacity-requirements-during-specific-calendar-dates-js-1a6fdd0c8844
query-postgresql-for-available-rooms-matching-capacity-requirements-during-specific-calendar-dates
hotel-booking
database-access
Query postgresql for available rooms matching capacity requirements during specific calendar dates.
js
import { Prisma } from '@prisma/client'; import { z } from 'zod'; import { prisma } from '../database/client.js'; const calendarDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/).refine( (value) => { const date = new Date(value); return Number.isFinite(date.getTime()) && date.toISOString().slice(0, 10)...
56
false
false
false
false
true
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "over-abstracted-1a6fdd0c8844-l22-l26-8a187510", "flag": "over_abstracted", "start_line": 22, "end_line": 26, "excerpt": "const roomAvailabilityReader = {", "explanation": "This single-method object only forwards the query to prisma.room.findMany without adding policy or be...
check-that-submitting-an-evaluation-containing-profanity-automatically-triggers-the-moderation-queue-flag-js-e2d795a12093
check-that-submitting-an-evaluation-containing-profanity-automatically-triggers-the-moderation-queue-flag
reviews
test
Check that submitting an evaluation containing profanity automatically triggers the moderation queue flag.
js
const { createReviewTestContext } = require("../support/review-context"); const positiveEvaluation = { reviewerId: "reviewer-274", productId: "product-18", rating: 5, text: "The replacement arrived quickly and works well." }; test("submitting a profane evaluation flags it for moderation", async () => ...
29
false
false
true
false
false
false
false
false
false
false
dead_code
3
subtle
[]
[ { "finding_slug": "dead-code-e2d795a12093-l3-l8-385cebe5", "flag": "dead_code", "start_line": 3, "end_line": 8, "excerpt": "const positiveEvaluation = {", "explanation": "The positiveEvaluation fixture is never referenced or exported and therefore does not participate in the test, so it shou...
export-typescript-interfaces-representing-upload-progress-events-error-metadata-objects-and-configuration-properties-ts-3d0186141dc8
export-typescript-interfaces-representing-upload-progress-events-error-metadata-objects-and-configuration-properties
file-uploads
type-definitions
Export TypeScript interfaces representing upload progress events, error metadata objects, and configuration properties.
ts
import { ApiClientError } from '@api/errors' export type UploadStatus = 'pending' | 'uploading' | 'completed' | 'failed' export interface UploadProgressEvent { readonly fileId: string readonly loadedBytes: number readonly totalBytes: number readonly percentage: number } interface UploadRetryPolicy { readon...
28
false
false
true
false
false
false
false
false
false
false
dead_code
4
subtle
[]
[ { "finding_slug": "dead-code-3d0186141dc8-l12-l15-63572069", "flag": "dead_code", "start_line": 12, "end_line": 15, "excerpt": "interface UploadRetryPolicy {", "explanation": "UploadRetryPolicy is neither exported nor referenced anywhere in this snippet, so the unused interface should be rem...
render-a-pricing-table-grid-displaying-monthly-and-annual-subscription-tiers-with-a-toggle-switch-for-promotional-discount-codes-jsx-fea0b080c26b
render-a-pricing-table-grid-displaying-monthly-and-annual-subscription-tiers-with-a-toggle-switch-for-promotional-discount-codes
subscription-billing
react-component
Render a pricing table grid displaying monthly and annual subscription tiers with a toggle switch for promotional discount codes.
jsx
import { useState } from 'react' import { useNavigate } from 'react-router-dom' const SUBSCRIPTION_TIERS = [ { id: 'tier-starter', name: 'Starter', monthlyPrice: 15, annualPrice: 144 }, { id: 'tier-growth', name: 'Growth', monthlyPrice: 49, annualPrice: 470 }, { id: 'tier-scale', name: 'Scale', monthlyPric...
43
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]