Dataset Viewer
Auto-converted to Parquet Duplicate
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 ...
End of preview. Expand in Data Studio

JS/TS Code Review Decisions

Training data and a benchmark for a small decision model that flags bad JavaScript and TypeScript code in real time.

The dataset contains 12,000 synthetic code snippets and 27,450 line-level findings. Each snippet has 10 Boolean flaw labels: unclear naming, noise comments, dead code, inconsistent style, over-abstraction, too-clever code, duplicated logic, error handling problems, type safety holes, and unsafe input. Each of the 3,000 tasks has 4 variants: one with no labeled flaws and three with flaws.

The decisions config poses the same data as typed decisions: a snippet is the state, and a model answers 13 typed questions about it at once, each with a probability. The schema follows the System One primitives (noul, choice, score), so a row replays against any API with that shape.

Leaderboard

Results cover the test split of the decisions config: 300 tasks, 1,200 cases, and 15,600 decisions. score_decisions.py evaluates answers to each complete case: state plus all 13 questions. Specialist models are fitted on train and ranked separately from zero-shot general models. This release includes specialist and reference baselines.

Metric TF-IDF Prior Uniform
Macro F1 @ 0.5 0.502 0.000 0.237
Accuracy 0.830 0.766 0.189
Log loss 0.449 0.636 0.895
Brier 0.172 0.230 0.343
ECE 0.030 0.005 0.319
  • TF-IDF: TF-IDF + logistic regression, a specialist fitted on train. Implementation: baseline_decisions.py. Local p50 latency: 1.2 ms; local execution rather than API pricing.
  • Prior: reference baseline using train label frequencies, without the input.
  • Uniform: reference baseline assigning equal probability to every option.

Higher is better for macro F1 and accuracy; lower is better for log loss, Brier, and ECE. 95% intervals for the TF-IDF row: macro F1 0.476 to 0.525, accuracy 0.824 to 0.836, log loss 0.434 to 0.462, Brier 0.167 to 0.176. Latency was measured locally, one case at a time, on 16 Neoverse V3 cores without a GPU. By question type its accuracy is 0.895 on the 11 nouls, 0.482 on primary_flaw, and 0.459 on quality, and it judges 31% of clean test cases clean.

The Prior baseline has the lowest ECE but a macro F1 of 0: it predicts no flaw at the 0.5 cutoff. Report calibration metrics alongside F1 and accuracy.

Metrics

score_decisions.py reports all five metrics, scored and total case counts, and probability mass assigned to unknown options. Partial runs are scored on completed cases.

  • Macro F1 at 0.5: F1 for each of the 10 flaw nouls with yes meaning P(yes) at or above 0.5, averaged. This follows the Jev evaluation paper's method for multi-label tasks posed as one yes/no question per label.
  • Accuracy: share of the 15,600 decisions where the top answer is the gold one. Nouls use the 0.5 cutoff; choice and score use the most probable option.
  • Log loss: minus the natural log of the probability given to the gold answer, floored at 0.000001. Because the gold is a single label, this equals the KL divergence from the gold distribution.
  • Brier: (P(yes) minus truth) squared for nouls; the sum over options of (probability minus one-hot gold) squared for choice and score.
  • ECE: expected calibration error with 15 equal-width bins, averaged over the 13 questions. Nouls bin P(yes) against the truth; choice and score bin the top probability against whether that option was right.

Intervals are 95% bootstrap intervals from 500 resamples of test tasks; a task's 4 variants move together.

Evaluation reference: Evaluating and Benchmarking the System One Model Jev, §3.4, arXiv 2609.37647. The paper describes Jev's evaluation methodology, not this dataset.

Reading a score

Gold labels come from blind model review, with a separate finding-level audit that accepted 98.3% of findings. Each finding includes its audit_verdict.

The TF-IDF baseline's per-flag F1 ranges from 0.023 on duplicated_logic to 0.880 on noise_comments. Report per-question results and breakdowns by difficulty alongside aggregate scores.

Adding a model

Answer every test case of the decisions config and write one line per case, {"id": ..., "answers": ..., "latency_ms": ...}, where answers is the map the API returned, with full distributions. Then:

uv run --no-project --with pyarrow==26.0.0 --with numpy==2.5.4 python3 score_decisions.py ANSWERS.jsonl

Open a discussion with the tables it prints, the model and version, the date, the mode (specialist or general), the request shape if it was not the whole case in one request, the hardware or endpoint behind the latency, and the price. Keep the answers file so the row can be rescored.

Flaw definitions

These are the definitions used during annotation. A snippet can have several flags; counts are snippets with the flag set to true.

The short names below are used in the results tables.

Naming

unclear_naming · 1,414 positive snippets.

Single letters outside short callbacks, names like data/temp/obj/handle, misleading names, abbreviations a new teammate could not expand.

Comments

noise_comments · 1,743 positive snippets.

Any comment, including JSDoc blocks, comments that explain why, and banners; code should explain itself through names, types and structure. Tool directives such as // @ts-check or // eslint-disable-next-line do not count, and commented-out code is dead_code.

Dead code

dead_code · 2,340 positive snippets.

Commented-out code, unused variables, imports, or parameters, unreachable branches, leftover console.log or debugger. Unused exports do not count, because callers are not visible.

Style

inconsistent_style · 1,437 positive snippets.

camelCase next to snake_case, async/await mixed with .then chains, var next to const, mixed quotes or semicolon use, all inside one snippet.

Abstraction

over_abstracted · 1,337 positive snippets.

An interface with one implementation, a factory or strategy for one case, generic parameters only ever used with one type, options that never vary, wrappers that only forward.

Clever code

too_clever · 1,622 positive snippets.

Nested ternaries, one reduce doing three jobs, bitwise tricks, comma operators, side effects hidden in short-circuit expressions, a regex doing a parser's work.

Duplication

duplicated_logic · 1,757 positive snippets.

The same logic appears two or more times with small variations.

Errors

error_handling_problem · 1,472 positive snippets.

Empty catch, catch that logs and carries on as if the call succeeded, promise with no rejection handling, errors converted to null or false with the cause lost, thrown strings.

Types

type_safety_hole · 1,447 positive snippets.

any, non-null !, as casts on unchecked values, @ts-ignore. In plain JS: loose equality where types can differ, property access on values that can be undefined.

Input

unsafe_input · 1,622 positive snippets.

Request bodies, query params, env vars, file contents, or API responses used unchecked. String-built SQL, innerHTML, eval, file paths built from user input.

For error handling, an awaited or returned promise propagates errors; a local catch is not required.

Example

This training row has two flags. Its code value:

const { CartLineItem, ProductVariant } = require('../models');
const cartReaders = {
    active: async (cartId) => await CartLineItem.findAll({
        where: { cartId, active: true },
        attributes: ['id', 'variantId', 'quantity', 'unitPrice'],
        include: [{ model: ProductVariant, as: 'variant', required: true, attributes: ['id', 'sku', 'color', 'size'] }],
        order: [['id', 'ASC']]
    })
};
const selectCartReader = (mode) => cartReaders[mode];
async function fetchActiveCartItems(cartId = Number(process.env.CART_ID)) {
    return await selectCartReader('active')(cartId);
}
module.exports = { fetchActiveCartItems };

The rest of the row:

{
  "snippet_slug": "query-the-relational-database-to-fetch-active-cart-line-items-and-join-product-variant-attributes-js-cfa9c2b0c6f9",
  "task_slug": "query-the-relational-database-to-fetch-active-cart-line-items-and-join-product-variant-attributes",
  "domain": "shopping-cart",
  "context": "database-access",
  "description": "Query the relational database to fetch active cart line items and join product variant attributes",
  "lang": "js",
  "line_count": 14,
  "unclear_naming": false,
  "noise_comments": false,
  "dead_code": false,
  "inconsistent_style": false,
  "over_abstracted": true,
  "too_clever": false,
  "duplicated_logic": false,
  "error_handling_problem": false,
  "type_safety_hole": false,
  "unsafe_input": true,
  "primary_flaw": "over_abstracted",
  "quality": 3,
  "difficulty": "subtle",
  "uncertain_flags": [],
  "findings": [
    {
      "finding_slug": "over-abstracted-cfa9c2b0c6f9-l2-l12-8521f090",
      "flag": "over_abstracted",
      "start_line": 2,
      "end_line": 12,
      "excerpt": "const cartReaders = {",
      "explanation": "The reader registry and mode selector implement only one strategy, and the sole call always selects 'active', so put the query directly in fetchActiveCartItems rather than routing through a single-case dispatch layer.",
      "audit_verdict": "valid"
    },
    {
      "finding_slug": "unsafe-input-cfa9c2b0c6f9-l11-l11-789284ad",
      "flag": "unsafe_input",
      "start_line": 11,
      "end_line": 11,
      "excerpt": "async function fetchActiveCartItems(cartId = Number(process.env.CART_ID)) {",
      "explanation": "The environment-derived cart ID reaches the database query after numeric conversion alone, which does not validate an identifier and can produce NaN or turn empty input into zero.",
      "audit_verdict": "valid"
    }
  ]
}

Load the dataset

Two configs hold the same 12,000 snippets. default is the flat snippet table with line-level findings. decisions is the same data as typed decisions: one row per snippet with a state, 13 typed questions, and the gold answers.

from datasets import load_dataset
import json

snippets = load_dataset("yannelli/js-ts-code-review-decisions", "default")
example = snippets["train"][0]
print(example["code"])
print(example["findings"])

decisions = load_dataset("yannelli/js-ts-code-review-decisions", "decisions", split="test")
row = decisions[0]
state, questions, gold = (json.loads(row[k]) for k in ("state", "questions", "gold"))
print(gold["dead_code"]["noul"], gold["primary_flaw"]["label"], gold["quality"]["score"])

Both configs have train, validation, and test splits stored as Parquet files. A local copy loads the same way when you pass its folder path to load_dataset.

Decisions config

The schema follows the System One primitives (noul, choice, score) of the TypeSafe API, so a row replays against any API with that shape. state and questions together are the body of a POST /v1/systemone request, minus model. The dataset is independent of TypeSafe.

state is a JSON object with task (the one-sentence task description), language, and code. questions is a JSON map of 13 questions, identical for every row and listed in manifest.json:

  • The 10 flaw questions (noul): Does this code have this flaw? Each question is named after its flag, and its criteria carry the flaw definition.
  • has_flaw (noul): Does this code have at least one code review flaw?
  • primary_flaw (choice): Which problem matters most? 11 options: none plus the 10 flaws.
  • quality (score): How mergeable is this code? 5 levels, from "Should not merge." to "Exemplary. Merge as is."

gold stores one answer per question: noul for yes/no questions, label plus one-hot probabilities for choice and score, and score for the score question. Score levels are indexed from 0, so level i is quality i + 1 in the default config. Flat <question>__label, <question>__probability_true, <question>__probabilities, and quality__score columns repeat the same answers for convenience.

Each gold answer is a hard label encoded as a one-hot distribution. One blind model reviewer set each label, and a second model audited every finding. task_slug, lang, difficulty, and uncertain_flags are metadata, not model input.

To replay a case against a System One API and keep its answers in the scorer's format:

import json, time, requests

body = {"state": state, "questions": questions, "model": "jev-latest"}
started = time.perf_counter()
answers = requests.post("https://api.typesafe.ai/v1/systemone", json=body, headers=headers).json()["answers"]
line = {"id": row["id"], "answers": answers, "latency_ms": 1000 * (time.perf_counter() - started)}
print(json.dumps(line))

Write one such line per test case to a JSONL file and score it with python3 score_decisions.py FILE.jsonl from this folder, as described under Leaderboard.

Train and evaluate

Use code as input and the 10 flaw labels as independent binary targets. Include description if the model needs to know the task's intended behavior. Several labels can be true for the same snippet.

A snippet is the training example. Its findings identify individual flaws, with line ranges and explanations. They support label inspection and training for flaw localization. Clean snippets have an empty findings list and all 10 labels set to false.

Keep the labels, findings, primary_flaw, quality, difficulty, and uncertain_flags out of the input. They reveal the answers: every snippet with quality 5 is a clean variant. Report macro F1 over the 10 flags at a 0.5 cutoff as the primary score, then per-flag F1, false positives on clean code, and inference latency on the test split. A threshold for each flag can be tuned on the validation split. To get a leaderboard row, answer the decisions config instead and run score_decisions.py.

Flag baseline

The flag baseline uses the same multi-label metrics: macro F1 with each flag's probability cut at 0.5 is the primary score, with macro F1 at thresholds tuned on validation, threshold-free AUROC and AUPRC, and calibration (Brier score and ECE over 15 equal-width bins). Intervals are 95% bootstrap intervals from 500 resamples of test tasks, with a task's 4 variants resampled together.

The baseline uses TF-IDF over code tokens and one logistic regression per flag, with code as the only input:

  • Tokens: identifiers and single punctuation characters, as unigrams and bigrams (min_df=2, sublinear term frequency, case kept).
  • Model: scikit-learn 1.9.1 LogisticRegression (C=4, balanced class weights, liblinear, random_state=0), trained on train.
  • Tuned thresholds: for each flag, the validation threshold with the best F1, applied unchanged to test.

Test results:

Score Value 95% interval
Macro F1 @ 0.5 0.574 0.554–0.595
Macro F1, tuned 0.583 0.562–0.602
Micro F1 @ 0.5 0.563 0.542–0.586
Macro AUROC 0.848 0.837–0.860
Macro AUPRC 0.635 0.618–0.659

Per-flag F1

F1 @ 0.5 uses a fixed cutoff; tuned F1 uses per-flag validation thresholds. Short names map to the flaw definitions. Test-positive counts are listed under Label statistics.

Flag F1 @ 0.5 Tuned F1
Naming 0.848 0.854
Comments 0.920 0.930
Dead code 0.419 0.422
Style 0.418 0.425
Abstraction 0.524 0.532
Clever code 0.590 0.606
Duplication 0.302 0.348
Errors 0.694 0.696
Types 0.521 0.519
Input 0.500 0.496

Ranking

Flag AUROC AUPRC
Naming 0.969 0.912
Comments 0.997 0.979
Dead code 0.702 0.469
Style 0.793 0.480
Abstraction 0.868 0.550
Clever code 0.880 0.655
Duplication 0.706 0.337
Errors 0.937 0.808
Types 0.811 0.588
Input 0.818 0.569

Calibration

Flag Brier ECE
Naming 0.036 0.089
Comments 0.027 0.097
Dead code 0.169 0.181
Style 0.140 0.217
Abstraction 0.107 0.157
Clever code 0.096 0.136
Duplication 0.130 0.118
Errors 0.072 0.148
Types 0.104 0.159
Input 0.117 0.141

Mean Brier score is 0.100 and mean ECE is 0.144. The balanced class weights push probabilities up for rare flags, which shows in the ECE. At the 0.5 cutoff the baseline flags at least one problem on 178 of the 300 clean test snippets, and on 197 at the tuned thresholds. Naming and comment flags score highest; duplicated logic, dead code, and inconsistent style score lowest.

The leaderboard's TF-IDF row uses the same tokens with one unweighted regression per question and C chosen by validation log loss. That trade is visible in the two sets of numbers: the balanced weights here score 0.574 macro F1 at 0.5 with an ECE of 0.144, while the unweighted row scores 0.502 with an ECE of 0.030, because an unweighted model rarely crosses 0.5 on flags that are true in 11% to 20% of snippets.

Splits

Val denotes the validation split in the tables below.

Count Train Val Test
Snippets 9,600 1,200 1,200
Tasks 2,400 300 300
Clean 2,400 300 300
Findings 22,005 2,746 2,699

All 4 variants of a task share a task_slug and stay in the same split. The supplied splits assign 80% of tasks to training, 10% to validation, and 10% to testing. Keep these splits when training; splitting individual variants can put versions of the same task in both training and evaluation. Packaging refuses to build if a task appears in two splits, if any code value repeats, or if a task does not have 4 variants with exactly one clean.

The snippets cover 40 domains and 13 code contexts. Languages: 4,559 JavaScript, 516 JSX, 6,209 TypeScript, and 716 TSX snippets. manifest.json lists the SHA-256 and row count of every data file to identify the dataset version used in an evaluation.

Label statistics

Positive snippets per flag and split:

Flag Train Val Test
Naming 1,140 135 139
Comments 1,382 183 178
Dead code 1,882 235 223
Style 1,146 144 147
Abstraction 1,061 131 145
Clever code 1,313 145 164
Duplication 1,422 164 171
Errors 1,182 150 140
Types 1,165 134 148
Input 1,290 167 165

Test has 139 to 223 positives per flag, so one snippet moves a flag's test recall by less than 1 percentage point.

Flags per flawed snippet:

Flags Snippets
1 3,996
2 3,438
3 1,089
4 347
5 116
6 14

Quality scores:

Quality Snippets Clean
1 1,250 0
2 3,118 0
3 3,612 0
4 1,100 80
5 2,920 2,920

Difficulty: 3,652 obvious, 7,422 subtle, and 926 borderline snippets.

Class declarations appear in 28.8% of over_abstracted snippets, 29.4% of other flawed snippets, and 27.2% of clean snippets.

Fields

default config

  • snippet_slug (string): Unique snippet identifier: task slug, language, and a code hash suffix.
  • task_slug (string): Descriptive task name shared by its 4 variants. Use for grouping, not as model input.
  • domain (string): Business domain of the task.
  • context (string): Code context of the task, such as http-handler or react-hook.
  • description (string): One-sentence task description all 4 variants implement.
  • lang (string): js, jsx, ts, or tsx.
  • code (string): Source code. Lines are split on \n.
  • line_count (int64): len(code.split("\n")).
  • unclear_naming (bool): True when the snippet has an unclear_naming finding.
  • noise_comments (bool): True when the snippet has a noise_comments finding.
  • dead_code (bool): True when the snippet has a dead_code finding.
  • inconsistent_style (bool): True when the snippet has an inconsistent_style finding.
  • over_abstracted (bool): True when the snippet has an over_abstracted finding.
  • too_clever (bool): True when the snippet has a too_clever finding.
  • duplicated_logic (bool): True when the snippet has a duplicated_logic finding.
  • error_handling_problem (bool): True when the snippet has an error_handling_problem finding.
  • type_safety_hole (bool): True when the snippet has a type_safety_hole finding.
  • unsafe_input (bool): True when the snippet has an unsafe_input finding.
  • primary_flaw (string): The most important flag, or none for the clean variant.
  • quality (int64): Mergeability from 1 (should not merge) to 5 (exemplary).
  • difficulty (string): obvious, subtle, or borderline, defined below.
  • uncertain_flags (list<string>): Flags with a defensible competing interpretation. Can name a flag that is false. Empty for most snippets.
  • findings (list<struct>): Line-level annotations, using the nested fields below. Empty for clean snippets.

Each item in findings has these fields:

  • finding_slug (string): Unique finding identifier: flag name, snippet code hash, line range, and explanation hash.
  • flag (string): One of the 10 flag names.
  • start_line (int64): First line of the flaw, 1-indexed.
  • end_line (int64): Last line of the flaw, 1-indexed and at least start_line.
  • excerpt (string): Exact text of start_line, including indentation.
  • explanation (string): One sentence explaining the flaw.
  • audit_verdict (string): Audit result: valid, invalid, wrong_flag, or wrong_lines.

Line numbers start at 1 and include both endpoints. A flag is true exactly when at least one finding uses that flag.

Difficulty describes how hard the snippet is to judge. obvious means a quick scan is enough; subtle requires closer inspection; borderline means a reviewer could defend a different answer under a plausible reading of a flag definition. Borderline snippets have at least one entry in uncertain_flags.

decisions config

  • id (string): The snippet's snippet_slug.
  • task_slug (string): Task shared by the 4 variants; the bootstrap unit. Not model input.
  • split (string): train, validation, or test.
  • lang (string): js, jsx, ts, or tsx.
  • difficulty (string): As in default.
  • uncertain_flags (list<string>): As in default.
  • state (string): JSON object with task, language, and code.
  • questions (string): JSON map of the 13 questions, identical for every row.
  • gold (string): JSON map of the gold answers, one per question, in the API answer shape.
  • n_questions (int64): 13.
  • <noul>__label (string): true or false, for the 10 flaws and has_flaw.
  • <noul>__probability_true (float64): 1.0 or 0.0.
  • primary_flaw__label (string): none or a flaw name.
  • primary_flaw__probabilities (string): JSON one-hot over the 11 options.
  • quality__label (string): Level index 0 to 4.
  • quality__probabilities (string): JSON one-hot over the 5 levels.
  • quality__score (float64): The level index as a number.

Files

  • data/: train.parquet, validation.parquet, and test.parquet contain the default config: snippets, labels, and findings.
  • decisions/: the same three split filenames contain the decisions config: state, questions, and gold.
  • manifest.json: SHA-256 and row count of every data file, and the 13 questions.
  • eval.yaml: The leaderboard metrics, config, and split.
  • score_decisions.py: Scores an answers file on a split; also prints the Prior and Uniform rows.
  • baseline_decisions.py: Fits and writes the TF-IDF leaderboard row.
  • baselines/: tfidf-logreg.test.jsonl contains that row's test answers, so the row can be rescored.
  • LICENSE: CC BY 4.0.

Creation and validation

Language models generated the snippets against a fixed set of tasks and flaw definitions, in three rounds of 1,000 tasks. Model reviewers read the code without seeing the planned labels, recorded findings, and sent failed examples back for repair and another review.

In the second and third rounds, the writer and reviewer were different models, and each flawed variant is a small edit of its task's clean variant, so the planted flaws are the main difference between them. Each of those tasks was also planned around either classes or plain functions, so that declaring a class is about as common with over_abstracted as without it. These rounds also plan dead_code and duplicated_logic more often. The third round used a writer model from a different developer than the first two.

Validation checked JavaScript/TypeScript syntax, unique code, task grouping, field types, label/finding agreement, and finding locations and excerpts. All 12,000 snippets passed those checks.

A separate model audited all 27,450 findings, and audit_verdict records its result.

The noise_comments rule changed after the first round: comments that explained why used to be exempt. First-round snippets were brought under the current rule. A model added 349 comment findings to 220 flawed snippets (120 of which had no noise_comments label before), and comments were removed from 84 clean snippets so they stay clean. The audit accepted all 349 added findings.

For the first-round tasks, a language model later edited task descriptions and finding explanations for clarity. That edit did not change code, labels, line ranges, or excerpts.

Annotation audit

Labels follow the supplied flaw definitions. uncertain_flags records disputed cases.

The audit accepted 26,984 findings (98.30%) and challenged 466: 455 invalid, 6 wrong flag, and 5 wrong line range. Challenged findings remain in the labels; 185 invalid verdicts concern unclear_naming, and 166 positive flag labels rely entirely on challenged findings. Use audit_verdict to select an annotation subset.

The audit proposed 284 additional findings, which are excluded from the released labels. All but one concern snippets already labeled as flawed. The remaining proposal concerns a rejection handler that prints the error and sets exit code 1; its clean label was retained.

Limitations

noise_comments follows a deterministic rule: any comment other than a tool directive or commented-out code sets the flag. A comment detector can classify this label.

Later rounds have fewer borderline snippets: 600 in the first round, 244 in the second, and 82 in the third.

Validation covers syntax and annotation consistency, not execution or type-checking.

Class balance is fixed at 25% clean snippets rather than sampled from production code. Evaluate false positives on code from the deployment environment.

Near-duplicate detection across tasks and public-benchmark overlap checks were not performed.

Privacy

The snippets contain synthetic names and records. A regex scan of all code, descriptions and explanations found 234 email-like strings (35 distinct, on 11 domains, mostly acme.test, example.com and client.test) and 32 IPv4 addresses: the loopback address 127.0.0.1 and addresses in the 198.51.100.0/24 and 203.0.113.0/24 documentation ranges. It found no matches for the phone-number, API-key, access-token, or private-key patterns checked. Privacy screening used these regex checks only.

License and attribution

This dataset is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You can copy, share, and adapt it, including commercially. When sharing it or an adaptation, credit Ryan Yannelli, link to the license, and indicate any changes. The full terms are in LICENSE.

Suggested attribution: Ryan Yannelli (2026), JS/TS Code Review Decisions, CC BY 4.0.

Citation

@misc{yannelli2026jstscodereviewdecisions,
  title        = {JS/TS Code Review Decisions},
  author       = {Ryan Yannelli},
  year         = {2026},
  publisher    = {Hugging Face},
  howpublished = {\url{https://huggingface.co/datasets/yannelli/js-ts-code-review-decisions}}
}

Maintainer

Ryan Yannelli | 10/11/2026 | GitHub: @yannelli | Hugging Face: yannelli

Appendix: slug format

task_slug comes from the task description: Unicode NFKD normalization, ASCII conversion, lowercase letters, and hyphens between runs of letters or digits. It has no leading or trailing hyphen.

snippet_slug appends the language and the first 12 hexadecimal characters of the code's SHA-256 hash to the task slug, separated by hyphens. finding_slug combines the hyphenated flag name, that code hash, l<start_line>-l<end_line>, and the first 8 hexadecimal characters of the explanation's SHA-256 hash. Hashes use UTF-8 text.

The hash suffixes distinguish variants and separate findings on the same lines. Slugs depend on their source text and change when that text changes. All slug fields are metadata; exclude them from model inputs.

Downloads last month
45

Models trained or fine-tuned on yannelli/js-ts-code-review-decisions

Collection including yannelli/js-ts-code-review-decisions