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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aggregate-raw-listing-impressions-by-neighborhood-identifier-to-calculate-average-daily-views-per-zone-ts-21bea7589cc2 | 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 impressionSchema = z.array(z.object({
neighborhood... | 56 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
check-that-booking-a-double-booked-time-slot-correctly-throws-a-conflict-exception-during-creation-js-d32200bf4337 | check-that-booking-a-double-booked-time-slot-correctly-throws-a-conflict-exception-during-creation | clinic-appointments | test | Check that booking a double-booked time slot correctly throws a conflict exception during creation. | js | const { describe, it, expect, beforeEach, vi } = require("vitest");
const { AppointmentService } = require("../src/appointment-service");
const { AppointmentRepository } = require("../src/appointment-repository");
const { ConflictError } = require("../src/errors");
describe("AppointmentService - Double Booking Prevent... | 48 | false | false | false | true | false | false | false | false | true | false | type_safety_hole | 3 | obvious | [] | [
{
"finding_slug": "inconsistent-style-d32200bf4337-l16-l16-994572f3",
"flag": "inconsistent_style",
"start_line": 16,
"end_line": 16,
"excerpt": " const booked_slot = {",
"explanation": "This local uses snake_case while the other locals, such as existingAppointment and newAppointmentPaylo... |
process-incoming-post-request-to-add-a-new-stock-keeping-unit-item-into-the-authenticated-customer-cart-js-41aca06852ae | process-incoming-post-request-to-add-a-new-stock-keeping-unit-item-into-the-authenticated-customer-cart | shopping-cart | http-handler | Process incoming POST request to add a new stock keeping unit item into the authenticated customer cart | js | import { getSession } from "next-auth/react";
import { CartRepository } from "../../server/repositories/cartRepository";
import { StockKeepingUnitValidator } from "../../server/validators/stockKeepingUnitValidator";
import { InventoryServiceClient } from "../../server/services/inventoryServiceClient";
export default f... | 47 | false | false | false | true | false | false | false | true | true | false | error_handling_problem | 2 | obvious | [] | [
{
"finding_slug": "type-safety-hole-41aca06852ae-l14-l14-9229f128",
"flag": "type_safety_hole",
"start_line": 14,
"end_line": 14,
"excerpt": "\t\t\tif (!session || !session.user.id) {",
"explanation": "Checking session does not establish that its optional user property exists, so reading use... |
manage-local-conflict-validation-states-and-auto-save-draft-appointment-details-when-input-fields-lose-keyboard-focus-ts-0f09ed8b51a8 | manage-local-conflict-validation-states-and-auto-save-draft-appointment-details-when-input-fields-lose-keyboard-focus | scheduling | react-hook | Manage local conflict validation states and auto-save draft appointment details when input fields lose keyboard focus. | ts | import { useCallback, useEffect, useRef, useState } from "react";
import { z } from "zod";
export interface AppointmentDraft {
appointmentId: string;
clientName: string;
startTime: string;
durationMinutes: number;
}
const conflictSchema = z.object({
hasConflict: z.boolean(),
conflictingAppointm... | 59 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
dispatch-automated-reminder-emails-to-patients-twenty-four-hours-before-their-scheduled-clinic-consultation-ts-ed4d906958a5 | dispatch-automated-reminder-emails-to-patients-twenty-four-hours-before-their-scheduled-clinic-consultation | clinic-appointments | async-job | Dispatch automated reminder emails to patients twenty-four hours before their scheduled clinic consultation. | ts | import cron from "node-cron"
import { prisma } from "../lib/prisma"
import { sendEmail } from "../services/email"
async function dispatchAppointmentReminders(): Promise<void> {
const target = new Date()
target.setUTCSeconds(0, 0)
target.setTime(target.getTime() + 24 * 60 * 60 * 1000)
const appointments = await pri... | 48 | false | false | false | false | false | true | false | true | false | true | too_clever | 2 | obvious | [] | [
{
"finding_slug": "unsafe-input-ed4d906958a5-l9-l21-2823cb12",
"flag": "unsafe_input",
"start_line": 9,
"end_line": 21,
"excerpt": "\tconst appointments = await prisma.appointment.findMany({",
"explanation": "Unlike the other variants, this variant consumes database records directly as email... |
query-the-relational-database-to-fetch-active-cart-line-items-and-join-product-variant-attributes-js-cfa9c2b0c6f9 | query-the-relational-database-to-fetch-active-cart-line-items-and-join-product-variant-attributes | shopping-cart | database-access | Query the relational database to fetch active cart line items and join product variant attributes | js | 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: t... | 14 | false | false | false | false | true | false | false | false | false | true | over_abstracted | 3 | subtle | [] | [
{
"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 p... |
calculate-the-hierarchical-inheritance-path-for-nested-security-groups-to-resolve-effective-rights-ts-62f7c4e6dadb | calculate-the-hierarchical-inheritance-path-for-nested-security-groups-to-resolve-effective-rights | permissions | utility | Calculate the hierarchical inheritance path for nested security groups to resolve effective rights. | ts | import _ from 'lodash';
import { z } from 'zod';
export interface SecurityGroupNode {
id: string;
name: string;
parentGroupId: string | null;
}
export interface GroupRepository {
findById(id: string): Promise<SecurityGroupNode | null>;
}
const groupSchema = z.object({ id: z.string(), name: z.string(), parentGroupI... | 40 | false | false | false | false | false | false | false | false | false | false | none | 5 | borderline | [
"duplicated_logic"
] | [] |
format-integer-minor-currency-units-into-localized-string-representations-with-the-appropriate-iso-currency-symbol-prefix-ts-bc550cd77820 | format-integer-minor-currency-units-into-localized-string-representations-with-the-appropriate-iso-currency-symbol-prefix | subscription-billing | utility | Format integer minor-currency units into localized string representations with the appropriate ISO currency symbol prefix. | ts | interface BillingAmountRenderer {
render(minorUnits: number, currency: string, locale: string): string
}
class LocalizedBillingAmountRenderer implements BillingAmountRenderer {
render(minorUnits: number, currency: string, locale: string): string {
if (!Number.isSafeInteger(minorUnits)) throw new RangeE... | 28 | false | false | false | false | true | false | false | true | false | false | error_handling_problem | 2 | obvious | [] | [
{
"finding_slug": "over-abstracted-bc550cd77820-l1-l19-9909421e",
"flag": "over_abstracted",
"start_line": 1,
"end_line": 19,
"excerpt": "interface BillingAmountRenderer {",
"explanation": "A renderer interface with just one implementation adds a class-based abstraction to a single formattin... |
purge-historical-audit-logs-older-than-three-retention-years-from-the-archival-cold-storage-partition-tables-js-9ca582ceccfe | purge-historical-audit-logs-older-than-three-retention-years-from-the-archival-cold-storage-partition-tables | warehouse-operations | cli-script | Purge historical audit logs older than three retention years from the archival cold storage partition tables. | js | import { readdir, readFile, writeFile } from 'node:fs/promises'
import { z } from 'zod'
const archiveRoot = new URL('../cold-storage/audit/', import.meta.url)
const partitionNames = z.array(z.string().regex(/^audit-\d{4}-(0[1-9]|1[0-2])\.json$/))
const auditRows = z.array(z.object({ id: z.string().min(1), warehouseId:... | 30 | false | false | false | true | false | false | false | true | false | false | error_handling_problem | 2 | obvious | [] | [
{
"finding_slug": "inconsistent-style-9ca582ceccfe-l9-l17-71128026",
"flag": "inconsistent_style",
"start_line": 9,
"end_line": 17,
"excerpt": " const retention_boundary = new Date();",
"explanation": "retention_boundary and partition_url use snake_case, whereas archiveRoot, partitionName... |
render-a-delivery-progress-tracker-timeline-showing-estimated-arrival-dates-and-current-transit-checkpoints-jsx-da51df76d043 | render-a-delivery-progress-tracker-timeline-showing-estimated-arrival-dates-and-current-transit-checkpoints | shipping | react-component | Render a delivery progress tracker timeline showing estimated arrival dates and current transit checkpoints | jsx | import { useQuery } from '@tanstack/react-query'
import { z } from 'zod'
const transitDate = z.string().min(1).refine(value => Number.isFinite(Date.parse(value)))
const checkpointsSchema = z.array(z.object({
timestamp: transitDate,
statusDescription: z.string().min(1),
facilityLocation: z.string().min(1)
}... | 61 | false | false | true | false | false | false | true | false | false | false | dead_code | 3 | subtle | [] | [
{
"finding_slug": "duplicated-logic-da51df76d043-l27-l29-935b9abd",
"flag": "duplicated_logic",
"start_line": 27,
"end_line": 29,
"excerpt": " const response = await fetch(`/api/shipments/${encodeURIComponent(shipmentId)}/eta`, { signal })",
"explanation": "This repeats the fetch,... |
render-a-breakdown-chart-displaying-net-pay-federal-tax-state-tax-and-benefit-deduction-percentages-tsx-eb837f2c1301 | render-a-breakdown-chart-displaying-net-pay-federal-tax-state-tax-and-benefit-deduction-percentages | payroll | react-component | Render a breakdown chart displaying net pay, federal tax, state tax, and benefit deduction percentages. | tsx | import { Box, LinearProgress, Paper, Typography } from "@mui/material"
import { z } from "zod"
const metricsSchema = z.object({ netPay: z.number(), federalTax: z.number(), stateTax: z.number(), benefits: z.number() })
type PayrollMetrics = z.infer<typeof metricsSchema>
interface PayrollMetricsProvider {
read(paylo... | 27 | false | false | false | false | true | false | false | false | false | false | over_abstracted | 3 | subtle | [] | [
{
"finding_slug": "over-abstracted-eb837f2c1301-l6-l14-13a518ec",
"flag": "over_abstracted",
"start_line": 6,
"end_line": 14,
"excerpt": "interface PayrollMetricsProvider {",
"explanation": "A provider interface, its sole implementation, and a singleton instance exist just to forward read ca... |
process-queued-batch-email-dispatches-by-fetching-user-contact-lists-and-sending-through-the-mail-relay-api-js-84d26fc725cd | 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 eventSchema = z.object({ Records: z.array(z.object({ body: z.string() })) });
const dispatchSchema = z.object({
userIds: z.array(z.string().min(1)), templateId: z.string().m... | 37 | false | false | false | true | false | false | false | true | false | false | error_handling_problem | 2 | obvious | [] | [
{
"finding_slug": "inconsistent-style-84d26fc725cd-l11-l11-e1b4755b",
"flag": "inconsistent_style",
"start_line": 11,
"end_line": 11,
"excerpt": "async function fetch_recipient_emails(userIds) {",
"explanation": "The helper fetch_recipient_emails uses snake_case while other locally defined i... |
receive-incoming-telemetry-pings-from-active-delivery-vans-validate-payload-signatures-and-queue-raw-gps-coordinates-for-ingestion-js-a08a32145d59 | receive-incoming-telemetry-pings-from-active-delivery-vans-validate-payload-signatures-and-queue-raw-gps-coordinates-for-ingestion | fleet-tracking | http-handler | Receive incoming telemetry pings from active delivery vans, validate payload signatures, and queue raw GPS coordinates for ingestion. | js | const crypto = require("crypto");
const { z } = require("zod");
const { telemetryPayloadSchema } = require("./telemetryValidation");
const { isActiveVan } = require("../services/fleet");
const { ingestQueue } = require("../services/telemetryQueue");
const previousSignatureHeader = "X-Van-Signature";
async function ha... | 43 | false | false | true | false | false | false | false | false | false | true | unsafe_input | 3 | subtle | [] | [
{
"finding_slug": "dead-code-a08a32145d59-l7-l7-594539c9",
"flag": "dead_code",
"start_line": 7,
"end_line": 7,
"excerpt": "const previousSignatureHeader = \"X-Van-Signature\";",
"explanation": "Remove the obsolete signature-header constant previousSignatureHeader because it is never referen... |
calculate-the-estimated-reading-time-in-minutes-for-a-given-markdown-lecture-transcript-string-and-word-count-ts-abb9639f203a | calculate-the-estimated-reading-time-in-minutes-for-a-given-markdown-lecture-transcript-string-and-word-count | course-management | utility | Calculate the estimated reading time in minutes for a given markdown lecture transcript string and word count. | ts | import _ from "lodash";
export const lectureReadingEstimator = {
async calculate(content: string, wordCount: number): Promise<number> {
if (_.isEmpty(content)) {
throw new Error('Lecture transcript content cannot be empty for reading time estimation.');
}
const transcriptWordCount = _.words(conten... | 16 | false | false | false | true | false | false | false | false | false | false | inconsistent_style | 3 | obvious | [] | [
{
"finding_slug": "inconsistent-style-abb9639f203a-l6-l6-7e792065",
"flag": "inconsistent_style",
"start_line": 6,
"end_line": 6,
"excerpt": " throw new Error('Lecture transcript content cannot be empty for reading time estimation.');",
"explanation": "This single-quoted string conflict... |
render-the-summary-card-displaying-total-paid-unpaid-and-overdue-invoice-amounts-for-the-selected-business-client-tsx-f4931a7369fa | render-the-summary-card-displaying-total-paid-unpaid-and-overdue-invoice-amounts-for-the-selected-business-client | invoicing | react-component | Render the summary card displaying total paid, unpaid, and overdue invoice amounts for the selected business client. | tsx | import { useQuery } from "@tanstack/react-query"
import { z } from "zod"
const invoiceSchema = z.array(z.object({
amountCents: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
status: z.enum(["paid", "unpaid"]),
dueAt: z.string().datetime({ offset: true })
}))
const money = new Intl.NumberForma... | 36 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
process-webhook-events-from-the-identity-provider-to-sync-suspended-user-accounts-and-clear-caches-ts-f585885e7f2c | process-webhook-events-from-the-identity-provider-to-sync-suspended-user-accounts-and-clear-caches | permissions | async-job | Process webhook events from the identity provider to sync suspended user accounts and clear caches. | ts | import type { Request, Response } from 'express';
import { z } from 'zod';
import { updateAccountStatus } from '../services/account.service';
import { revokeUserSessions } from '../services/session.service';
import { invalidatePermissionCache } from '../services/permission.service';
import { logger } from '../utils/log... | 39 | false | false | false | false | false | false | false | true | false | false | error_handling_problem | 2 | subtle | [] | [
{
"finding_slug": "error-handling-problem-f585885e7f2c-l34-l38-1b7c284f",
"flag": "error_handling_problem",
"start_line": 34,
"end_line": 38,
"excerpt": " } catch (error) {",
"explanation": "Service failures are logged but swallowed, causing the handler to report success even if account syn... |
process-incoming-webhook-payloads-from-the-analytics-pipeline-to-increment-daily-impression-counters-for-active-flags-ts-72f3aa92f15d | process-incoming-webhook-payloads-from-the-analytics-pipeline-to-increment-daily-impression-counters-for-active-flags | feature-flags | async-job | Process incoming webhook payloads from the analytics pipeline to increment daily impression counters for active flags. | ts | import { Job } from 'bullmq';
import { Redis } from 'ioredis';
import { z } from 'zod';
const AnalyticsPayloadSchema = z.object({
flagKey: z.string().min(1),
environmentId: z.string().uuid(),
incrementBy: z.number().int().positive(),
timestamp: z.string().datetime(),
});
export async function processI... | 40 | false | true | false | false | false | false | false | true | false | false | error_handling_problem | 2 | subtle | [] | [
{
"finding_slug": "error-handling-problem-72f3aa92f15d-l18-l21-07642008",
"flag": "error_handling_problem",
"start_line": 18,
"end_line": 21,
"excerpt": " } catch {",
"explanation": "A failed Redis activation lookup is converted to false with its cause discarded, so the job returns succes... |
implement-a-redux-slice-managing-active-pipeline-filters-search-queries-and-selected-deal-identifiers-ts-7813caf11539 | implement-a-redux-slice-managing-active-pipeline-filters-search-queries-and-selected-deal-identifiers | crm | state-management | Implement a Redux slice managing active pipeline filters, search queries, and selected deal identifiers. | ts | import { createSlice, PayloadAction } from '@reduxjs/toolkit';
export interface PipelineFilterState {
searchQuery: string;
selectedDealIds: string[];
activeStageId: string | null;
}
const initialState: PipelineFilterState = {
searchQuery: '', selectedDealIds: [], activeStageId: null,
};
export const pi... | 29 | false | false | false | true | false | true | false | false | false | false | too_clever | 3 | obvious | [] | [
{
"finding_slug": "too-clever-7813caf11539-l20-l20-6829dc78",
"flag": "too_clever",
"start_line": 20,
"end_line": 20,
"excerpt": " !!~index ? state.selectedDealIds.splice(index, 1) : state.selectedDealIds.push(action.payload);",
"explanation": "The bitwise-complement and double-ne... |
define-typescript-interfaces-representing-room-amenities-seasonal-pricing-rules-and-booking-policies-ts-31e6de77eece | define-typescript-interfaces-representing-room-amenities-seasonal-pricing-rules-and-booking-policies | hotel-booking | type-definitions | Define TypeScript interfaces representing room amenities, seasonal pricing rules, and booking policies. | ts | export interface RoomAmenity {
code: string; label: string; included: boolean;
}
export interface SeasonalPricingRule {
startDateInclusive: string; endDateExclusive: string;
nightlyRateCents: number; currency: string;
}
export interface BookingPolicy {
minimumNights: number; cancellationNoticeHours: number; dep... | 25 | false | false | false | false | false | true | false | false | true | false | too_clever | 2 | obvious | [] | [
{
"finding_slug": "type-safety-hole-31e6de77eece-l11-l11-624c20d2",
"flag": "type_safety_hole",
"start_line": 11,
"end_line": 11,
"excerpt": "const defaults: any = ([",
"explanation": "Declaring defaults as any disables checks on the properties subsequently assigned to the three typed export... |
execute-a-background-worker-task-that-archives-audit-log-records-older-than-ninety-years-into-cold-object-storage-ts-65554835dc87 | execute-a-background-worker-task-that-archives-audit-log-records-older-than-ninety-years-into-cold-object-storage | audit-logging | async-job | Execute a background worker task that archives audit log records older than ninety years into cold object storage. | ts | import cron from 'node-cron'
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3'
import { readAuditArchiveCandidates, markAuditArchived } from './audit-store.js'
import { workerHealth } from './worker-health.js'
const storage = new S3Client({})
type AuditRecord = {
id: string
occurredAt: string
actor... | 55 | false | false | false | false | false | false | false | true | true | true | error_handling_problem | 1 | obvious | [] | [
{
"finding_slug": "type-safety-hole-65554835dc87-l18-l18-14f869c5",
"flag": "type_safety_hole",
"start_line": 18,
"end_line": 18,
"excerpt": " const bucket = process.env.AUDIT_ARCHIVE_BUCKET as string",
"explanation": "The assertion treats a possibly missing environment variable as a stri... |
attach-keyboard-shortcut-event-listeners-to-start-and-stop-the-floating-stopwatch-widget-instantly-js-6ae8021eabda | attach-keyboard-shortcut-event-listeners-to-start-and-stop-the-floating-stopwatch-widget-instantly | time-tracking | dom-code | Attach keyboard shortcut event listeners to start and stop the floating stopwatch widget instantly. | js | function createStopwatchCommand(button) {
return { execute: () => button.click() }
}
export function attachStopwatchShortcuts(widget, anchor) {
const shortcuts = JSON.parse(widget.dataset.shortcuts ?? "null")
if (!shortcuts || typeof shortcuts !== "object" || Array.isArray(shortcuts) ||
typeof shortcuts.st... | 44 | false | true | false | false | true | false | false | false | false | false | over_abstracted | 3 | subtle | [] | [
{
"finding_slug": "over-abstracted-6ae8021eabda-l1-l3-0f8d7189",
"flag": "over_abstracted",
"start_line": 1,
"end_line": 3,
"excerpt": "function createStopwatchCommand(button) {",
"explanation": "The command factory creates objects whose sole operation forwards to button.click(), and since t... |
implement-a-redux-slice-to-track-selected-purchase-order-filters-search-queries-and-pagination-parameters-ts-28a992ab9c5b | 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_... | 32 | false | false | false | true | false | true | false | false | false | false | too_clever | 3 | obvious | [] | [
{
"finding_slug": "inconsistent-style-28a992ab9c5b-l22-l26-31621e16",
"flag": "inconsistent_style",
"start_line": 22,
"end_line": 26,
"excerpt": " if (action.type === \"SET_ROWS_PER_PAGE\") {",
"explanation": "This branch uses double-quoted strings and semicolon-terminated statements, where... |
define-typescript-interfaces-for-customer-contact-profiles-communication-preferences-and-lead-scores-ts-28f8e17bd32c | 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";
export interface CommunicationPreferences {
channels: CommunicationChannel[];
doNotContact: boolean;
}
export interface LeadScore {
value: number;
evaluatedAt: string;
}
export interface CustomerContactProfile {
id: string;
displayNam... | 17 | false | false | false | false | false | false | false | false | false | false | none | 5 | obvious | [] | [] |
provide-a-debounced-search-term-state-and-auto-fetching-list-of-matching-invoice-records-by-vendor-name-or-tax-number-js-2c87fdb42df9 | 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 invoiceListSchema = 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]... | 52 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
group-submitted-expense-line-items-by-their-assigned-accounting-cost-center-code-and-calculate-the-sum-total-for-each-group-js-0aede479ab7e | group-submitted-expense-line-items-by-their-assigned-accounting-cost-center-code-and-calculate-the-sum-total-for-each-group | expense-reports | data-transform | Group submitted expense line items by their assigned accounting cost center code and calculate the sum total for each group. | js | import { fetchExpenseLineItems } from "../services/expenseApiClient.js"
export function aggregateExpensesByCostCenter(reportId) {
return fetchExpenseLineItems(reportId).then(lineItems => {
if (!Array.isArray(lineItems)) {
throw new TypeError("Expected expense line items")
}
const totals = lineItems.reduce((g... | 21 | false | false | false | false | false | true | false | false | false | false | too_clever | 3 | obvious | [] | [
{
"finding_slug": "too-clever-0aede479ab7e-l8-l15-dc39d092",
"flag": "too_clever",
"start_line": 8,
"end_line": 15,
"excerpt": "\t\tconst totals = lineItems.reduce((groups, item) => (",
"explanation": "The reducer combines validation, an immediately invoked throwing function, accumulation, a... |
execute-nightly-reconciliation-queries-to-flag-shipments-missing-final-proof-of-delivery-signatures-js-689663967987 | 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 flaggedShipmentsSchema = z.array(z.object({
id: z.string().uuid(),
delivered_at: z.date()
}));
const reconciliationSql = `
WITH flagged AS (
UPDATE shipments AS s
SET pod_review_required = TRUE
WHERE s.status = 'delivered'
AND s.delivered_at... | 48 | false | true | false | true | true | false | true | false | false | true | unsafe_input | 2 | borderline | [
"over_abstracted"
] | [
{
"finding_slug": "over-abstracted-689663967987-l28-l34-2e3a62bf",
"flag": "over_abstracted",
"start_line": 28,
"end_line": 34,
"excerpt": "function createPodStore(db) {",
"explanation": "This single-use factory returns a single forwarding method with no extra policy or behavior, so calling ... |
process-queued-direct-deposit-payment-batch-files-and-notify-banking-partner-via-secured-sftp-upload-js-47a6acb0a169 | process-queued-direct-deposit-payment-batch-files-and-notify-banking-partner-via-secured-sftp-upload | payroll | async-job | Process queued direct deposit payment batch files and notify banking partner via secured SFTP upload. | js | import { Client } from 'ssh2';
import { join } from 'node:path';
import { z } from 'zod';
const requestSchema = z.object({ batchId: z.string().uuid() });
const batchSchema = z.object({
id: z.string().uuid(),
fileName: z.string().regex(/^[A-Za-z0-9_-]+\.ach$/)
});
function receiptName(fileName) {
return fileName.re... | 60 | false | false | true | true | false | false | false | false | false | false | dead_code | 3 | subtle | [] | [
{
"finding_slug": "dead-code-47a6acb0a169-l11-l13-8a2d5bf4",
"flag": "dead_code",
"start_line": 11,
"end_line": 13,
"excerpt": "function receiptName(fileName) {",
"explanation": "This unexported helper is never referenced; receipt naming is not part of the executed upload flow.",
"audit_... |
process-stripe-webhook-events-for-failed-invoice-payments-and-update-the-account-billing-status-column-in-the-database-ts-108cbf8eb549 | process-stripe-webhook-events-for-failed-invoice-payments-and-update-the-account-billing-status-column-in-the-database | subscription-billing | http-handler | Process Stripe webhook events for failed invoice payments and update the account billing status column in the database. | ts | import { NextResponse } from 'next/server';
import Stripe from 'stripe';
import { z } from 'zod';
import { eq } from 'drizzle-orm';
import { db } from '@/lib/database';
import { accounts } from '@/lib/schema';
const apiKey = z.string().regex(/^(?:sk|rk)_(?:test|live)_[A-Za-z0-9]+$/).parse(process.env.STRIPE_SECRET_KEY... | 30 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
assert-that-filtering-rental-listings-by-maximum-nightly-rate-correctly-omits-properties-above-the-threshold-ts-2f2f327d1de3 | assert-that-filtering-rental-listings-by-maximum-nightly-rate-correctly-omits-properties-above-the-threshold | property-listings | test | Assert that filtering rental listings by maximum nightly rate correctly omits properties above the threshold. | ts | import request from 'supertest';
import { z } from "zod";
import { createRentalTestApp } from './support/rental-app.js';
it('omits rentals above the maximum nightly rate and includes the boundary', async () => {
const affordableRental = {
id: 'canal-loft',
nightlyRate: 90,
};
const boundary_rental = {
... | 43 | false | false | false | true | false | false | false | false | false | false | inconsistent_style | 3 | obvious | [] | [
{
"finding_slug": "inconsistent-style-2f2f327d1de3-l2-l2-23196c4b",
"flag": "inconsistent_style",
"start_line": 2,
"end_line": 2,
"excerpt": "import { z } from \"zod\";",
"explanation": "This import uses double quotes while the neighboring imports use single quotes.",
"audit_verdict": "v... |
process-stripe-webhook-events-for-failed-invoice-payments-and-update-the-account-billing-status-column-in-the-database-ts-763f5994e978 | process-stripe-webhook-events-for-failed-invoice-payments-and-update-the-account-billing-status-column-in-the-database | subscription-billing | http-handler | Process Stripe webhook events for failed invoice payments and update the account billing status column in the database. | ts | import { NextResponse } from 'next/server';
import Stripe from 'stripe';
import { z } from 'zod';
import { eq } from 'drizzle-orm';
import { db } from '@/lib/database';
import { accounts } from '@/lib/schema';
const stripe = new Stripe(z.string().regex(/^(sk|rk)_(test|live)_[A-Za-z0-9]+$/).parse(process.env.STRIPE_SEC... | 20 | false | false | true | false | false | true | false | false | false | false | too_clever | 3 | obvious | [] | [
{
"finding_slug": "too-clever-763f5994e978-l17-l17-65ca23d3",
"flag": "too_clever",
"start_line": 17,
"end_line": 17,
"excerpt": "\t\t\t? ((customer) => customer && db.update(accounts).set({ billingStatus: 'past_due' }).where(eq(accounts.stripeCustomerId, customer)).then(() => NextResponse.json(... |
accept-incoming-post-requests-containing-consumer-feedback-submissions-and-validate-payload-fields-before-database-insertion-ts-efe6fd82c66c | accept-incoming-post-requests-containing-consumer-feedback-submissions-and-validate-payload-fields-before-database-insertion | reviews | http-handler | Accept incoming POST requests containing consumer feedback submissions and validate payload fields before database insertion. | ts | import type { NextApiRequest, NextApiResponse } from "next"
import { z } from "zod"
import { prisma } from "@/lib/prisma"
const reviewSchema = z.object({
productId: z.string().uuid(),
rating: z.number().int().min(1).max(5),
title: z.string().min(2).max(100),
body: z.string().min(10).max(1000)
})
inter... | 61 | true | false | false | false | false | false | false | false | false | false | unclear_naming | 4 | subtle | [] | [
{
"finding_slug": "unclear-naming-efe6fd82c66c-l55-l55-cf501223",
"flag": "unclear_naming",
"start_line": 55,
"end_line": 55,
"excerpt": " const idx = createdRecord.id",
"explanation": "idx conventionally means an index, but this value is a newly created review's identifier, so review... |
purge-stale-shipping-label-temporary-files-older-than-seven-days-from-local-storage-disk-volumes-js-217fe01b13a3 | purge-stale-shipping-label-temporary-files-older-than-seven-days-from-local-storage-disk-volumes | shipping | cli-script | Purge stale shipping label temporary files older than seven days from local storage disk volumes | js | import { readdir, stat, unlink } from "node:fs/promises";
import { join } from "node:path";
export async function purgeStaleShippingLabels(directoryPath) {
const currentTime = Date.now();
const maxAgeMilliseconds = 7 * 24 * 60 * 60 * 1000;
const directoryEntries = await readdir(directoryPath, { withFileTyp... | 26 | false | true | false | false | false | false | false | false | false | true | unsafe_input | 3 | subtle | [] | [
{
"finding_slug": "noise-comments-217fe01b13a3-l17-l17-40d91213",
"flag": "noise_comments",
"start_line": 17,
"end_line": 17,
"excerpt": " // Remove shipping labels past the retention window.",
"explanation": "Restates the age check and unlink operation rather than explaining why ... |
persist-updated-delivery-instructions-submitted-from-the-customer-account-settings-modal-and-revalidate-the-order-details-view-ts-d780ed8917b7 | persist-updated-delivery-instructions-submitted-from-the-customer-account-settings-modal-and-revalidate-the-order-details-view | order-management | server-action | Persist updated delivery instructions submitted from the customer account settings modal and revalidate the order details view. | ts | import { z } from "zod"
import { TRPCError } from "@trpc/server"
import { revalidatePath } from "next/cache"
import { protectedProcedure } from "@/server/api/trpc"
const deliveryInstructionsInput = z.object({
orderId: z.string().uuid(),
deliveryInstructions: z.unknown()
})
export const updateDeliveryInstructi... | 36 | false | false | false | false | false | true | false | false | false | true | unsafe_input | 2 | obvious | [] | [
{
"finding_slug": "unsafe-input-d780ed8917b7-l14-l14-b8025127",
"flag": "unsafe_input",
"start_line": 14,
"end_line": 14,
"excerpt": " const deliveryInstructions = String(input.deliveryInstructions).trim() || null",
"explanation": "The schema accepts deliveryInstructions as unknown wi... |
receive-incoming-email-webhook-payloads-from-the-provider-validate-the-authorization-signature-and-dispatch-a-new-support-ticket-creation-job-js-ac892cca65e8 | receive-incoming-email-webhook-payloads-from-the-provider-validate-the-authorization-signature-and-dispatch-a-new-support-ticket-creation-job | customer-support | http-handler | Receive incoming email webhook payloads from the provider, validate the authorization signature, and dispatch a new support ticket creation job. | js | import { createHmac, timingSafeEqual } from "node:crypto";
import { z } from "zod";
import { enqueueSupportTicket } from "@/server/support/jobs";
export const runtime = "nodejs";
class EmailWebhookDispatcher {
constructor(deliver) {
this.deliver = deliver;
}
dispatch(ticket) {
return this.... | 43 | false | false | false | false | true | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "over-abstracted-ac892cca65e8-l7-l15-cdcdd750",
"flag": "over_abstracted",
"start_line": 7,
"end_line": 15,
"excerpt": "class EmailWebhookDispatcher {",
"explanation": "This single-use dispatcher class only stores a function and forwards dispatch calls to it, whereas callin... |
attach-input-mask-listeners-to-the-datepicker-element-to-enforce-valid-birthdate-formatting-on-patient-forms-js-7e145d221988 | attach-input-mask-listeners-to-the-datepicker-element-to-enforce-valid-birthdate-formatting-on-patient-forms | clinic-appointments | dom-code | Attach input mask listeners to the datepicker element to enforce valid birthdate formatting on patient forms. | js | import $ from "jquery";
export function attachBirthdateMask(element) {
if (!(element instanceof HTMLInputElement) || element.type !== "text") {
throw new TypeError("Birthdate requires a text input");
}
const $input = $(element);
function updateBirthdate(digits) {
const sections = [digit... | 36 | false | false | false | true | false | false | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "inconsistent-style-7e145d221988-l13-l19-c2411e29",
"flag": "inconsistent_style",
"start_line": 13,
"end_line": 19,
"excerpt": " const birth_date = new Date(0);",
"explanation": "The snake_case local birth_date mixes naming conventions with camelCase names such as at... |
create-a-custom-hook-that-debounces-sprint-planning-board-search-inputs-and-synchronizes-query-parameters-to-the-url-js-d78d29c4f2e4 | create-a-custom-hook-that-debounces-sprint-planning-board-search-inputs-and-synchronizes-query-parameters-to-the-url | project-management | react-hook | Create a custom hook that debounces sprint planning board search inputs and synchronizes query parameters to the URL. | js | import { useState, useEffect, useCallback } from 'react'
import { useSearchParams } from 'react-router-dom'
export function useSprintSearch(boardId) {
const [searchParams, setSearchParams] = useSearchParams()
if (typeof boardId !== 'string' || !boardId.length) throw new TypeError('A sprint board ID is required')
... | 32 | false | false | true | true | false | true | false | false | false | false | too_clever | 3 | obvious | [] | [
{
"finding_slug": "inconsistent-style-d78d29c4f2e4-l7-l7-467b28cd",
"flag": "inconsistent_style",
"start_line": 7,
"end_line": 7,
"excerpt": " const storage_key = `sprint-board-${boardId}`;",
"explanation": "Uses snake_case alongside camelCase locals such as searchQuery, and a statement-end... |
receive-incoming-binary-attachment-payloads-from-api-clients-and-pipe-data-streams-directly-into-cloud-object-storage-js-f7f03dc325b9 | receive-incoming-binary-attachment-payloads-from-api-clients-and-pipe-data-streams-directly-into-cloud-object-storage | file-uploads | http-handler | Receive incoming binary attachment payloads from API clients and pipe data streams directly into cloud object storage. | js | import { S3Client, DeleteObjectCommand } from "@aws-sdk/client-s3";
import { Upload } from "@aws-sdk/lib-storage";
const storage = new S3Client({ region: "us-east-1" });
const bucket = "enterprise-file-storage";
export default async function uploadHandler(fastify, options) {
fastify.post("/api/uploads", async (reque... | 28 | false | false | true | false | false | false | true | false | false | true | unsafe_input | 2 | borderline | [
"dead_code"
] | [
{
"finding_slug": "dead-code-f7f03dc325b9-l7-l7-035d1318",
"flag": "dead_code",
"start_line": 7,
"end_line": 7,
"excerpt": "export default async function uploadHandler(fastify, options) {",
"explanation": "The options parameter is unused; remove it from the signature.",
"audit_verdict": ... |
process-incoming-payment-gateway-provider-webhook-events-to-update-invoice-status-from-pending-to-paid-ts-ac3ff3fad08a | process-incoming-payment-gateway-provider-webhook-events-to-update-invoice-status-from-pending-to-paid | invoicing | async-job | Process incoming payment gateway provider webhook events to update invoice status from pending to paid. | ts | import { z } from 'zod';
import { pool } from '../storage/postgres.js';
export type GatewayEvent = {
id: string;
type: 'payment.succeeded' | 'charge.succeeded' | 'payment.failed';
payment: {
invoiceId: string;
reference: string;
amountCents: number;
currency: string;
settledAt: string;
};
}... | 46 | false | false | true | false | false | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "dead-code-ac3ff3fad08a-l18-l18-5ae15295",
"flag": "dead_code",
"start_line": 18,
"end_line": 18,
"excerpt": "]).transform((type, context) => {",
"explanation": "The transform callback never uses context, so the unused parameter should be removed.",
"audit_verdict": "va... |
query-postgresql-to-retrieve-all-active-subscriptions-where-the-next-renewal-date-falls-within-the-next-twenty-four-hours-ts-8321b509ba79 | query-postgresql-to-retrieve-all-active-subscriptions-where-the-next-renewal-date-falls-within-the-next-twenty-four-hours | subscription-billing | database-access | Query PostgreSQL to retrieve all active subscriptions where the next renewal date falls within the next twenty-four hours. | ts | import { Op, type Attributes, type FindOptions } from 'sequelize';
import { SubscriptionModel } from '../models/subscription.model.js';
const RENEWAL_WINDOW_MS = 24 * 60 * 60 * 1000;
async function executeRenewalQuery(
options: FindOptions<Attributes<SubscriptionModel>>
): Promise<SubscriptionModel[]> {
retur... | 26 | false | false | false | false | true | false | false | false | false | false | over_abstracted | 4 | subtle | [] | [
{
"finding_slug": "over-abstracted-8321b509ba79-l6-l10-1a8cfe80",
"flag": "over_abstracted",
"start_line": 6,
"end_line": 10,
"excerpt": "async function executeRenewalQuery(",
"explanation": "This helper only forwards its options to SubscriptionModel.findAll without adding renewal-specific b... |
manage-shipment-tracking-search-query-state-with-debounced-api-lookup-execution-and-loading-indicators-ts-a63db5023d3b | manage-shipment-tracking-search-query-state-with-debounced-api-lookup-execution-and-loading-indicators | shipping | react-hook | Manage shipment tracking search query state with debounced API lookup execution and loading indicators | ts | import { useEffect, useState } from 'react';
import useSWR from 'swr';
const previewStatuses = ['In transit', 'Delivered'];
function formatTrackingPreview(summary: string): string {
return `Shipment update: ${summary}`;
}
async function fetchTrackingSummary(url: string): Promise<string> {
const response = await fe... | 46 | true | false | true | false | false | false | false | false | false | true | dead_code | 3 | borderline | [
"unclear_naming"
] | [
{
"finding_slug": "dead-code-a63db5023d3b-l4-l4-5dfb31a2",
"flag": "dead_code",
"start_line": 4,
"end_line": 4,
"excerpt": "const previewStatuses = ['In transit', 'Delivered'];",
"explanation": "This local constant is never referenced, so remove the unused preview fixture.",
"audit_verdi... |
handle-form-submission-for-editing-a-previously-sent-chat-message-updating-the-revision-history-log-and-broadcasting-the-patch-js-4c3c710e9963 | handle-form-submission-for-editing-a-previously-sent-chat-message-updating-the-revision-history-log-and-broadcasting-the-patch | messaging | server-action | Handle form submission for editing a previously sent chat message, updating the revision history log and broadcasting the patch. | js | import { error, fail } from '@sveltejs/kit';
import { database } from '$lib/server/database';
import { messageEventBus } from '$lib/server/events';
export const actions = {
editMessage: ({ request, locals }) => {
return request.formData().then((formData) => {
if (!locals.user) {
throw error(401, 'S... | 43 | false | false | false | false | false | false | false | false | false | true | unsafe_input | 3 | subtle | [] | [
{
"finding_slug": "unsafe-input-4c3c710e9963-l13-l19-88a5bf25",
"flag": "unsafe_input",
"start_line": 13,
"end_line": 19,
"excerpt": " if (!messageId || typeof updatedBody !== 'string') {",
"explanation": "The truthiness check does not validate messageId as a nonblank string, allowing a... |
render-a-modal-dialog-displaying-customer-interaction-history-with-timeline-sorting-and-pagination-controls-tsx-2c3b0171bf0f | render-a-modal-dialog-displaying-customer-interaction-history-with-timeline-sorting-and-pagination-controls | crm | react-component | Render a modal dialog displaying customer interaction history with timeline sorting and pagination controls. | tsx | import { useEffect, useRef, useState } from "react";
import { useForm } from "react-hook-form";
import { z } from "zod";
const historySchema = z.array(z.object({ id: z.string().min(1), occurredAt: z.string().datetime({ offset: true }),
channel: z.enum(["email", "call", "meeting"]), summary: z.string().min(1) }));
... | 40 | false | false | false | false | false | false | false | true | true | false | error_handling_problem | 2 | subtle | [] | [
{
"finding_slug": "type-safety-hole-2c3b0171bf0f-l20-l20-a7e1434c",
"flag": "type_safety_hole",
"start_line": 20,
"end_line": 20,
"excerpt": " let entries: any[] = [];",
"explanation": "The explicit any[] discards the schema's inferred entry type and disables checking of properties used i... |
calculate-the-volumetric-weight-surcharge-for-oversized-pallet-dimensions-using-standard-freight-conversion-ratios-ts-c142df4a1d00 | calculate-the-volumetric-weight-surcharge-for-oversized-pallet-dimensions-using-standard-freight-conversion-ratios | warehouse-operations | utility | Calculate the volumetric weight surcharge for oversized pallet dimensions using standard freight conversion ratios. | ts | import { z } from 'zod';
const palletSchema = z.object({
lengthCm: z.number().finite().positive().max(1000),
widthCm: z.number().finite().positive().max(1000),
heightCm: z.number().finite().positive().max(1000),
actualWeightKg: z.number().finite().positive(),
ratePerKg: z.number().finite().nonnegative().max(... | 34 | false | false | false | false | false | false | false | false | true | false | type_safety_hole | 4 | borderline | [
"type_safety_hole"
] | [
{
"finding_slug": "type-safety-hole-c142df4a1d00-l26-l28-38dad1c1",
"flag": "type_safety_hole",
"start_line": 26,
"end_line": 28,
"excerpt": " const conversion = freightConversions.find(",
"explanation": "The non-null assertion on find's result bypasses its possibly-undefined type, and al... |
fetch-all-fulfillment-records-joined-with-shipment-tracking-numbers-for-a-given-customer-identifier-sorted-by-dispatch-date-ts-c5448c7192bb | fetch-all-fulfillment-records-joined-with-shipment-tracking-numbers-for-a-given-customer-identifier-sorted-by-dispatch-date | order-management | database-access | Fetch all fulfillment records joined with shipment tracking numbers for a given customer identifier sorted by dispatch date | ts | import { Repository } from "typeorm";
import { FulfillmentRecord } from "../entity/FulfillmentRecord";
import { DatabaseConnectionException } from "../common/errors";
export class FulfillmentRepository {
constructor(private readonly repository: Repository<FulfillmentRecord>) {}
public async findShipmentsByCustomerI... | 29 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
stream-the-generated-pdf-binary-of-a-finalized-invoice-directly-to-the-client-browser-with-correct-content-disposition-headers-ts-66cb479b8fda | stream-the-generated-pdf-binary-of-a-finalized-invoice-directly-to-the-client-browser-with-correct-content-disposition-headers | invoicing | http-handler | Stream the generated PDF binary of a finalized invoice directly to the client browser with correct content-disposition headers. | ts | import type { Request, Response } from "express"
import { pipeline } from "node:stream/promises"
import contentDisposition from "content-disposition"
import { InvoiceService } from "../services/invoiceService"
import { NotFoundError, ValidationError } from "../errors"
export async function streamInvoicePdfHandler(requ... | 22 | false | false | false | false | false | false | false | true | false | true | error_handling_problem | 2 | subtle | [] | [
{
"finding_slug": "unsafe-input-66cb479b8fda-l8-l9-62a0f67c",
"flag": "unsafe_input",
"start_line": 8,
"end_line": 9,
"excerpt": "\tconst invoiceId = request.params.invoiceId",
"explanation": "The external route parameter is passed directly to the invoice lookup without validation, which Exp... |
render-the-summary-card-displaying-total-paid-unpaid-and-overdue-invoice-amounts-for-the-selected-business-client-tsx-08e925b1f3cc | render-the-summary-card-displaying-total-paid-unpaid-and-overdue-invoice-amounts-for-the-selected-business-client | invoicing | react-component | Render the summary card displaying total paid, unpaid, and overdue invoice amounts for the selected business client. | tsx | import { useQuery } from "@tanstack/react-query"
import { z } from "zod"
const invoiceSchema = z.array(z.object({
amountCents: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
status: z.enum(["paid", "unpaid"]),
dueAt: z.string().datetime({ offset: true })
}))
const money = new Intl.NumberForma... | 41 | false | false | true | false | false | false | false | false | false | false | dead_code | 4 | borderline | [
"dead_code"
] | [
{
"finding_slug": "dead-code-08e925b1f3cc-l37-l37-5f444f95",
"flag": "dead_code",
"start_line": 37,
"end_line": 37,
"excerpt": " {rows.map((row, index) => <div key={row.label}>",
"explanation": "The index parameter is never used because the key uses row.label, so the unused parameter ... |
calculate-the-final-discounted-price-given-an-original-subtotal-a-percentage-off-rate-and-a-maximum-allowed-monetary-discount-cap-ts-57715c0beb5c | calculate-the-final-discounted-price-given-an-original-subtotal-a-percentage-off-rate-and-a-maximum-allowed-monetary-discount-cap | promotions | utility | Calculate the final discounted price given an original subtotal, a percentage off rate, and a maximum allowed monetary discount cap | ts | export function calculateDiscountedPrice(
originalSubtotal: number,
percentageOff: number,
maxDiscount: number,
): number {
const v = [originalSubtotal, percentageOff, maxDiscount];
const n = ['originalSubtotal', 'percentageOff', 'maxDiscount'];
try {
for (const [i, x] of v.entries()) {
if (typeo... | 33 | true | false | false | false | false | false | false | true | false | false | error_handling_problem | 2 | obvious | [] | [
{
"finding_slug": "unclear-naming-57715c0beb5c-l6-l6-3fa490fc",
"flag": "unclear_naming",
"start_line": 6,
"end_line": 6,
"excerpt": " const v = [originalSubtotal, percentageOff, maxDiscount];",
"explanation": "v does not identify the promotion input values it holds.",
"audit_verdict": ... |
manage-concurrent-file-queue-states-including-active-transfers-paused-items-completed-lists-and-failure-arrays-ts-2a778d8c6cc5 | manage-concurrent-file-queue-states-including-active-transfers-paused-items-completed-lists-and-failure-arrays | file-uploads | state-management | Manage concurrent file queue states including active transfers, paused items, completed lists, and failure arrays. | ts | import { createContext, createElement, useContext, useReducer } from 'react';
import type { Dispatch, ReactNode } from 'react';
type Status = 'queued' | 'active' | 'paused' | 'completed' | 'failed';
export type Upload = { id: string; file: File; status: Status; error: string | null };
export type UploadAction =
| { ... | 54 | false | false | true | false | false | false | false | false | false | false | dead_code | 4 | subtle | [] | [
{
"finding_slug": "dead-code-2a778d8c6cc5-l16-l19-9ea1b7c4",
"flag": "dead_code",
"start_line": 16,
"end_line": 19,
"excerpt": "function remainingBytes(items: Upload[]): number {",
"explanation": "remainingBytes is neither exported nor referenced, so the unused calculation helper can be remo... |
process-server-actions-for-saving-user-search-queries-and-retrieving-recent-search-history-logs-js-0c7890fa5ce7 | 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');
const MAX_QUERY_LENGTH = 128;
async function action({ request }) {
const formData = await request.formData();
const intent = formData.get('intent');
if (intent !== 'save' && i... | 38 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
map-raw-authentication-provider-profile-responses-into-the-standard-internal-user-account-schema-structure-js-9816b3e7258c | map-raw-authentication-provider-profile-responses-into-the-standard-internal-user-account-schema-structure | user-profiles | data-transform | Map raw authentication provider profile responses into the standard internal user account schema structure. | js | const _ = require("lodash");
const { z } = require("zod");
const profileSchema = z.object({
id: z.string().optional(), sub: z.string().optional(), email: z.string().trim().email(),
name: z.string().optional(), given_name: z.string().optional(), family_name: z.string().optional(),
email_verified: z.boolean(... | 22 | false | false | true | false | false | false | false | false | false | false | dead_code | 4 | subtle | [] | [
{
"finding_slug": "dead-code-9816b3e7258c-l10-l10-0fe56495",
"flag": "dead_code",
"start_line": 10,
"end_line": 10,
"excerpt": "const providerNameFields = [\"name\", \"given_name\", \"family_name\"];",
"explanation": "This local constant is never read or exported; it is leftover code unrelat... |
render-the-summary-card-displaying-subtotal-estimated-shipping-fees-and-applicable-promotional-discount-codes-tsx-b4ba219c86b6 | render-the-summary-card-displaying-subtotal-estimated-shipping-fees-and-applicable-promotional-discount-codes | shopping-cart | react-component | Render the summary card displaying subtotal, estimated shipping fees, and applicable promotional discount codes | tsx | import { useState } from "react";
import { Card, CardContent, Typography, TextField, Button, Divider } from "@mui/material";
interface CartSummaryProps {
subtotal: number;
shipping: number;
discount: number;
promoCode: string | null;
onApplyPromo: (code: string) => Promise<void>;
}
export function CartSumma... | 39 | false | false | false | false | false | false | false | true | false | false | error_handling_problem | 3 | subtle | [] | [
{
"finding_slug": "error-handling-problem-b4ba219c86b6-l21-l22-e388b445",
"flag": "error_handling_problem",
"start_line": 21,
"end_line": 22,
"excerpt": " } catch {",
"explanation": "A rejected promotion application is swallowed because restoring the existing input neither reports the fai... |
render-a-responsive-amortization-schedule-table-displaying-monthly-principal-and-interest-breakdowns-for-fixed-rate-home-loans-jsx-30aec3c8ec22 | render-a-responsive-amortization-schedule-table-displaying-monthly-principal-and-interest-breakdowns-for-fixed-rate-home-loans | banking | react-component | Render a responsive amortization schedule table displaying monthly principal and interest breakdowns for fixed-rate home loans. | jsx | import { createContext, useContext, useReducer } from "react"
const LoanContext = createContext(null);
const money = new Intl.NumberFormat('en-US', { style: "currency", currency: 'USD' })
export function LoanProvider({ loan, children }) {
if (!loan || typeof loan !== "object" ||
!Number.isFinite(loan.principa... | 65 | false | false | false | true | false | false | false | false | false | false | inconsistent_style | 3 | obvious | [] | [
{
"finding_slug": "inconsistent-style-30aec3c8ec22-l3-l4-4fec81cf",
"flag": "inconsistent_style",
"start_line": 3,
"end_line": 4,
"excerpt": "const LoanContext = createContext(null);",
"explanation": "Semicolon use is inconsistent because this declaration has a semicolon while the next decla... |
calculate-sha-256-cryptographic-hashes-from-readable-file-streams-using-chunked-buffer-reading-to-prevent-memory-spikes-js-ab03cedec78b | calculate-sha-256-cryptographic-hashes-from-readable-file-streams-using-chunked-buffer-reading-to-prevent-memory-spikes | file-uploads | utility | Calculate SHA-256 cryptographic hashes from readable file streams using chunked buffer reading to prevent memory spikes. | js | import { createHash } from "node:crypto"
import { ReadableStream } from "node:stream/web"
const uploadBlockSize = 65536
const receiptClock = new Intl.DateTimeFormat("en", { timeZone: "UTC" })
export async function hashUpload(stream) {
if (!(stream instanceof ReadableStream)) {
throw new TypeError("Upload must b... | 47 | false | false | false | false | false | false | true | false | false | false | duplicated_logic | 3 | subtle | [] | [
{
"finding_slug": "duplicated-logic-ab03cedec78b-l26-l35-0a7cc8de",
"flag": "duplicated_logic",
"start_line": 26,
"end_line": 35,
"excerpt": " if (value.byteLength <= uploadBlockSize) {",
"explanation": "The small-chunk branch unnecessarily duplicates the block loop's hash update and by... |
process-domestic-return-label-generation-requests-by-validating-package-dimensions-and-calling-postal-carrier-apis-js-60faf17e79dd | 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 inches = z.number().finite().positive().max(36)
const requestSchema = z.object({
returnId: z.string().uuid(),
country: z.literal("US"),
postalCode: z.string().regex(/^\d{5}$/),
... | 39 | false | true | true | false | false | false | false | false | true | false | type_safety_hole | 3 | subtle | [] | [
{
"finding_slug": "dead-code-60faf17e79dd-l21-l21-5582e422",
"flag": "dead_code",
"start_line": 21,
"end_line": 21,
"excerpt": "const postalServiceCode = \"GROUND_ADVANTAGE_RETURN\"",
"explanation": "The local constant postalServiceCode is never referenced or passed to the carrier, so remove... |
query-the-relational-database-to-fetch-active-cart-line-items-and-join-product-variant-attributes-js-c511f8711863 | query-the-relational-database-to-fetch-active-cart-line-items-and-join-product-variant-attributes | shopping-cart | database-access | Query the relational database to fetch active cart line items and join product variant attributes | js | const { CartLineItem, ProductVariant } = require('../models');
async function fetchActiveCartItems(cartId = Number(process.env.CART_ID)) {
// Load active cart lines with their variant attributes.
return await CartLineItem.findAll({
where: { cartId, active: true },
attributes: ['id', 'variantId'... | 18 | false | true | false | false | false | false | false | false | false | true | unsafe_input | 3 | subtle | [] | [
{
"finding_slug": "unsafe-input-c511f8711863-l3-l3-914ad6a2",
"flag": "unsafe_input",
"start_line": 3,
"end_line": 3,
"excerpt": "async function fetchActiveCartItems(cartId = Number(process.env.CART_ID)) {",
"explanation": "The environment-derived cart ID is used in the query without validat... |
register-a-newly-acquired-transport-truck-into-the-database-and-assign-it-to-the-default-regional-maintenance-depot-js-68cdcce9604b | register-a-newly-acquired-transport-truck-into-the-database-and-assign-it-to-the-default-regional-maintenance-depot | fleet-tracking | server-action | Register a newly acquired transport truck into the database and assign it to the default regional maintenance depot. | js | import { json, redirect } from '@remix-run/node';
import { parseWithZod } from '@conform-to/zod';
import { z } from 'zod';
import { prisma } from '~/services/database.server';
import { requireFleetManagerSession } from '~/services/session.server';
const registerTransportTruckSchema = z.object({
vin: z.string().trim()... | 66 | false | false | false | false | false | false | false | false | false | false | none | 4 | subtle | [] | [] |
execute-checkout-redirection-by-validating-inventory-stock-levels-and-generating-a-temporary-payment-session-token-ts-12808c44fa2a | execute-checkout-redirection-by-validating-inventory-stock-levels-and-generating-a-temporary-payment-session-token | shopping-cart | server-action | Execute checkout redirection by validating inventory stock levels and generating a temporary payment session token | ts | import { fail, redirect } from '@sveltejs/kit';
import { z } from 'zod';
import { randomUUID } from 'node:crypto';
import { inventory, paymentSessions } from '$lib/server/checkout';
import type { Actions } from './$types';
const checkoutFields = z.object({
sku: z.string().trim().min(1).max(80)
});
const sessionExpir... | 26 | false | false | true | false | false | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "dead-code-12808c44fa2a-l10-l10-3c4dddb0",
"flag": "dead_code",
"start_line": 10,
"end_line": 10,
"excerpt": "const sessionExpiryLabel = (expiresAt: Date) => expiresAt.toISOString();",
"explanation": "The local helper sessionExpiryLabel is never referenced or exported and s... |
run-a-terminal-script-to-purge-resolved-notification-logs-older-than-ninety-days-from-the-database-js-7be08000f940 | 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';
async function deleteResolvedLogsBefore(cutoffDate) {
return await databasePool.query(
'DELETE FROM notification_logs WHERE status = $1 AND reso... | 30 | false | false | true | false | false | false | false | true | true | false | error_handling_problem | 2 | borderline | [
"dead_code",
"over_abstracted"
] | [
{
"finding_slug": "dead-code-7be08000f940-l13-l13-2632d8a1",
"flag": "dead_code",
"start_line": 13,
"end_line": 13,
"excerpt": "async function purgeResolvedNotifications(commandArguments) {",
"explanation": "The commandArguments parameter is never used, so the command handler can omit it.",
... |
verify-user-authorization-tokens-before-generating-presigned-upload-urls-for-secure-direct-browser-media-transfers-ts-eea0ee666dea | verify-user-authorization-tokens-before-generating-presigned-upload-urls-for-secure-direct-browser-media-transfers | file-uploads | server-action | Verify user authorization tokens before generating presigned upload URLs for secure direct browser media transfers. | ts | import { error, type Actions } from "@sveltejs/kit"
import { jwtVerify } from "jose"
import { z } from "zod"
import { randomUUID } from "node:crypto"
import { PutObjectCommand } from "@aws-sdk/client-s3"
import { getSignedUrl } from "@aws-sdk/s3-request-presigner"
import { mediaBucket, storage, uploadVerificationKey } ... | 33 | false | false | false | false | true | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "over-abstracted-eea0ee666dea-l11-l20-fabb2e90",
"flag": "over_abstracted",
"start_line": 11,
"end_line": 20,
"excerpt": "interface UploadIssuer {",
"explanation": "A behavioral interface and a single implementing object add a pluggable issuer layer with no alternative impl... |
query-the-relational-database-to-fetch-overdue-invoices-alongside-client-email-addresses-for-automated-payment-reminders-ts-c47f635d15e5 | query-the-relational-database-to-fetch-overdue-invoices-alongside-client-email-addresses-for-automated-payment-reminders | invoicing | database-access | Query the relational database to fetch overdue invoices alongside client email addresses for automated payment reminders. | ts | import { and, asc, eq, gt, lt } from "drizzle-orm";
import { z } from "zod";
import { db } from "../db";
import { clients, invoices } from "../db/schema";
export async function fetchOverdueInvoices(cutoff: string) {
try {
let boundary: Date;
const { id: i, clientId: c, dueAt: d, amountDueCents: a, status: s ... | 18 | true | false | false | false | false | true | false | true | false | false | error_handling_problem | 2 | obvious | [] | [
{
"finding_slug": "unclear-naming-c47f635d15e5-l9-l9-de37fabd",
"flag": "unclear_naming",
"start_line": 9,
"end_line": 9,
"excerpt": " const { id: i, clientId: c, dueAt: d, amountDueCents: a, status: s } = invoices;",
"explanation": "The five single-letter aliases are outside a short call... |
export-all-unverified-user-email-addresses-to-a-compressed-csv-file-for-the-compliance-audit-team-ts-bda39cdcd0fc | export-all-unverified-user-email-addresses-to-a-compressed-csv-file-for-the-compliance-audit-team | user-profiles | cli-script | Export all unverified user email addresses to a compressed CSV file for the compliance audit team. | ts | import { createWriteStream } from "node:fs";
import { pipeline } from "node:stream/promises";
import { createGzip } from "node:zlib";
import { parseArgs } from "node:util";
import { z } from "zod";
import { fetchUnverifiedUserEmails } from "../services/userProfileRepository.js";
const optionsSchema = z.object({
ou... | 36 | false | false | false | false | false | true | false | false | true | false | too_clever | 3 | subtle | [] | [
{
"finding_slug": "type-safety-hole-bda39cdcd0fc-l25-l25-7837bee1",
"flag": "type_safety_hole",
"start_line": 25,
"end_line": 25,
"excerpt": " const record: any = recordSchema.parse(value);",
"explanation": "The explicit any discards the schema's inferred, validated record type an... |
purge-all-inactive-customer-accounts-and-archived-support-tickets-older-than-seven-years-from-the-database-ts-c1fdf4b27932 | purge-all-inactive-customer-accounts-and-archived-support-tickets-older-than-seven-years-from-the-database | crm | cli-script | Purge all inactive customer accounts and archived support tickets older than seven years from the database. | ts | import { Command } from 'commander'
import { Pool } from 'pg'
const pool = new Pool()
const program = new Command()
async function executePurge(): Promise<void> {
const client = await pool.connect()
const deletionStatements = [
'DELETE FROM customer_accounts WHERE is_active = false AND updated_at < NOW() - IN... | 49 | false | true | false | false | false | false | false | false | true | false | type_safety_hole | 4 | borderline | [
"type_safety_hole"
] | [
{
"finding_slug": "noise-comments-c1fdf4b27932-l15-l15-b4f8a0af",
"flag": "noise_comments",
"start_line": 15,
"end_line": 15,
"excerpt": " // Purge inactive accounts and archived tickets beyond retention.",
"explanation": "The comment repeats the purpose already expressed by executePurge ... |
persist-current-editor-draft-content-to-local-storage-with-automatic-debounced-saving-intervals-ts-8a5495e3249b | persist-current-editor-draft-content-to-local-storage-with-automatic-debounced-saving-intervals | content-publishing | react-hook | Persist current editor draft content to local storage with automatic debounced saving intervals. | ts | import { useEffect, useState } from 'react';
interface UseDraftAutoSaveOptions {
articleId: string;
debounceMs?: number;
}
export function useDraftAutoSave(content: string, { articleId, debounceMs = 1500 }: UseDraftAutoSaveOptions) {
const [isSaving, setIsSaving] = useState(false);
const [lastSavedAt, setLast... | 41 | false | false | false | true | false | false | false | false | false | true | unsafe_input | 3 | subtle | [] | [
{
"finding_slug": "unsafe-input-8a5495e3249b-l22-l23-535dda0e",
"flag": "unsafe_input",
"start_line": 22,
"end_line": 23,
"excerpt": " const storagePrefix = process.env.NEXT_PUBLIC_EDITOR_DRAFT_STORAGE_PREFIX ?? 'content-publishing-draft-';",
"explanation": "The environment-provided stora... |
aggregate-raw-listing-impressions-by-neighborhood-identifier-to-calculate-average-daily-views-per-zone-ts-64a795fcfbca | 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 impressionSchema = z.array(z.object({
neighborhood... | 60 | false | true | true | false | false | false | false | false | false | false | dead_code | 4 | borderline | [
"dead_code",
"over_abstracted"
] | [
{
"finding_slug": "dead-code-64a795fcfbca-l21-l21-2a56c1c2",
"flag": "dead_code",
"start_line": 21,
"end_line": 21,
"excerpt": "const zoneDailyViewsSchema = impressionSchema.transform((impressions, context) => {",
"explanation": "The transform callback never uses its context parameter; omit ... |
handle-incoming-http-put-requests-to-update-user-contact-details-and-return-updated-profile-resources-js-1906b21f10a1 | handle-incoming-http-put-requests-to-update-user-contact-details-and-return-updated-profile-resources | user-profiles | http-handler | Handle incoming HTTP PUT requests to update user contact details and return updated profile resources. | js | const Router = require('@koa/router')
const { validateContactDetails } = require('../validators/userProfileValidator')
const { updateContactDetails } = require('../services/userService')
const router = new Router()
const contactAuditFields = ['phoneNumber', 'billingAddress', 'shippingAddress']
const contactUpdateTimeo... | 51 | false | false | true | false | false | false | false | false | false | true | dead_code | 3 | subtle | [] | [
{
"finding_slug": "dead-code-1906b21f10a1-l6-l6-20d144ff",
"flag": "dead_code",
"start_line": 6,
"end_line": 6,
"excerpt": "const contactAuditFields = ['phoneNumber', 'billingAddress', 'shippingAddress']",
"explanation": "This local constant is never read or exported.",
"audit_verdict": ... |
attach-a-live-input-validation-listener-to-the-checkout-discount-coupon-field-to-instantly-show-format-errors-in-the-red-tooltip-ts-d0df75ca9686 | attach-a-live-input-validation-listener-to-the-checkout-discount-coupon-field-to-instantly-show-format-errors-in-the-red-tooltip | order-management | dom-code | Attach a live input validation listener to the checkout discount coupon field to instantly show format errors in the red tooltip | ts | export {}
const source = document.querySelector('#discount-coupon-input')
const outlet = document.querySelector('#coupon-error-tooltip')
if (!(source instanceof HTMLInputElement) || !(outlet instanceof HTMLElement)) {
throw new Error('Checkout coupon controls are missing')
}
let position = 0
function process(valu... | 44 | true | false | false | false | false | false | false | false | false | false | unclear_naming | 3 | obvious | [] | [
{
"finding_slug": "unclear-naming-d0df75ca9686-l3-l3-563dea9b",
"flag": "unclear_naming",
"start_line": 3,
"end_line": 3,
"excerpt": "const source = document.querySelector('#discount-coupon-input')",
"explanation": "The name describes a generic source rather than the coupon input element it ... |
purge-historical-audit-logs-older-than-three-retention-years-from-the-archival-cold-storage-partition-tables-js-bd66b0e6f88f | purge-historical-audit-logs-older-than-three-retention-years-from-the-archival-cold-storage-partition-tables | warehouse-operations | cli-script | Purge historical audit logs older than three retention years from the archival cold storage partition tables. | js | import { readdir, readFile, writeFile } from 'node:fs/promises'
const archiveRoot = new URL('../cold-storage/audit/', import.meta.url)
export function purgeAuditLogs(callback) {
// Create the boundary date.
const retentionBoundary = new Date()
retentionBoundary.setUTCFullYear(retentionBoundary.getUTCFullY... | 32 | false | true | false | false | false | true | false | false | false | true | unsafe_input | 2 | obvious | [] | [
{
"finding_slug": "noise-comments-bd66b0e6f88f-l6-l6-cb07dc5f",
"flag": "noise_comments",
"start_line": 6,
"end_line": 6,
"excerpt": " // Create the boundary date.",
"explanation": "This merely describes the immediately following date creation.",
"audit_verdict": "valid"
},
{
... |
schedule-a-background-worker-syncing-daily-inventory-levels-and-discontinuing-items-with-zero-stock-across-all-warehouses-js-4fdc4307333f | schedule-a-background-worker-syncing-daily-inventory-levels-and-discontinuing-items-with-zero-stock-across-all-warehouses | product-catalog | async-job | Schedule a background worker syncing daily inventory levels and discontinuing items with zero stock across all warehouses. | js | const { z } = require('zod');
const cron = require('node-cron');
const inventoryRow = z.object({
sku: z.string().trim().min(1),
warehouseStocks: z.array(z.unknown()).min(1).max(10000)
});
const snapshotSchema = z.array(inventoryRow).refine(rows => {
const skus = new Set(rows.map(row => row.sku));
return skus.s... | 41 | false | true | false | false | false | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "unsafe-input-4fdc4307333f-l6-l6-cfbad8da",
"flag": "unsafe_input",
"start_line": 6,
"end_line": 6,
"excerpt": " warehouseStocks: z.array(z.unknown()).min(1).max(10000)",
"explanation": "The schema checks the array size but accepts every possible quantity value, so API-sup... |
validate-discount-code-inputs-and-apply-point-deductions-securely-during-checkout-mutations-ts-4931f9fd6da3 | validate-discount-code-inputs-and-apply-point-deductions-securely-during-checkout-mutations | loyalty-rewards | server-action | Validate discount code inputs and apply point deductions securely during checkout mutations. | ts | import { json, type ActionFunctionArgs } from '@remix-run/node'
import { z } from 'zod'
import { db } from '~/db.server'
import { requireUserId } from '~/auth.server'
export async function action({ request }: ActionFunctionArgs) {
const userId = await requireUserId(request)
const form = await request.formData()
... | 43 | false | true | false | false | false | false | true | false | false | false | duplicated_logic | 4 | borderline | [
"duplicated_logic"
] | [
{
"finding_slug": "duplicated-logic-4931f9fd6da3-l11-l17-cbc4cd1d",
"flag": "duplicated_logic",
"start_line": 11,
"end_line": 17,
"excerpt": " if (typeof checkoutValue !== 'string' || !checkoutValue.trim()) {",
"explanation": "The same string/nonempty check and identical 400 response are re... |
process-incoming-refund-webhook-payloads-by-validating-hmac-signatures-and-updating-the-corresponding-transaction-ledger-entry-js-9706fc8ee522 | process-incoming-refund-webhook-payloads-by-validating-hmac-signatures-and-updating-the-corresponding-transaction-ledger-entry | order-management | http-handler | Process incoming refund webhook payloads by validating HMAC signatures and updating the corresponding transaction ledger entry | js | const crypto = require('crypto');
const { NextResponse } = require('next/server');
const { z } = require('zod');
const ledgerRepository = require('@/repositories/ledgerRepository');
const auditLogger = require('@/services/audit');
const eventSchema = z.object({
id: z.string().trim().min(1),
type: z.literal('refund... | 44 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
execute-checkout-redirection-by-validating-inventory-stock-levels-and-generating-a-temporary-payment-session-token-ts-6a4c4f64feaf | execute-checkout-redirection-by-validating-inventory-stock-levels-and-generating-a-temporary-payment-session-token | shopping-cart | server-action | Execute checkout redirection by validating inventory stock levels and generating a temporary payment session token | ts | import { randomUUID } from 'node:crypto';
import { fail, redirect } from '@sveltejs/kit';
import { z } from 'zod';
import { inventory, paymentSessions } from '$lib/server/checkout';
import type { Actions } from './$types';
export const actions = {
default: async ({ request }) => {
const fields = await request.fo... | 20 | false | false | false | false | false | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "unsafe-input-6a4c4f64feaf-l13-l13-50eba4a9",
"flag": "unsafe_input",
"start_line": 13,
"end_line": 13,
"excerpt": " const quantity = Number(fields.get('quantity'));",
"explanation": "Number conversion does not validate the request quantity as a finite positive integer b... |
attach-a-native-pointer-event-listener-to-the-interactive-dispatch-map-canvas-to-capture-bounding-box-selection-coordinates-ts-261ab1bf169e | attach-a-native-pointer-event-listener-to-the-interactive-dispatch-map-canvas-to-capture-bounding-box-selection-coordinates | fleet-tracking | dom-code | Attach a native pointer event listener to the interactive dispatch map canvas to capture bounding box selection coordinates. | ts | export type DispatchSelection = {
fleetId: string
left: number
top: number
right: number
bottom: number
}
export function attachDispatchSelection(
canvas: HTMLCanvasElement,
form: HTMLFormElement,
onSelect: (selection: DispatchSelection) => void,
onError: (error: unknown) => void
):... | 53 | false | false | false | false | false | true | false | false | true | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "type-safety-hole-261ab1bf169e-l35-l35-cd34a2ee",
"flag": "type_safety_hole",
"start_line": 35,
"end_line": 35,
"excerpt": " const fleetId = new FormData(form).get(\"fleetId\") as string",
"explanation": "FormData.get can return a string, File, or null, and the a... |
bind-scroll-event-listeners-to-the-message-history-container-to-automatically-load-older-chat-entries-when-reaching-the-top-viewport-ts-d0a38f6de761 | bind-scroll-event-listeners-to-the-message-history-container-to-automatically-load-older-chat-entries-when-reaching-the-top-viewport | messaging | dom-code | Bind scroll event listeners to the message history container to automatically load older chat entries when reaching the top viewport. | ts | import { historyPageSchema } from "./historySchema";
import { appendHistoricalMessages } from "./historyRenderer";
const SCROLL_THRESHOLD_PX = 50;
export async function attachHistoryScrollListener(historyContainerElement: HTMLElement): Promise<void> {
let isLoadingMoreHistory = false;
historyContainerElement.add... | 42 | true | true | false | false | false | false | false | false | false | false | noise_comments | 3 | subtle | [] | [
{
"finding_slug": "unclear-naming-d0a38f6de761-l14-l14-e15cb88b",
"flag": "unclear_naming",
"start_line": 14,
"end_line": 14,
"excerpt": " const data = oldestMessageElement?.getAttribute(\"data-message-id\");",
"explanation": "The name data does not communicate that this value is the olde... |
check-that-quarterly-federal-unemployment-insurance-tax-calculations-match-the-latest-government-compliance-formulas-jsx-153b2e22bd4a | 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 | 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', wagesCents: 600000 },... | 64 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
define-typescript-interfaces-for-sepa-credit-transfer-payloads-including-mandatory-debtor-and-creditor-international-bank-account-numbers-ts-7525d027dbc6 | define-typescript-interfaces-for-sepa-credit-transfer-payloads-including-mandatory-debtor-and-creditor-international-bank-account-numbers | banking | type-definitions | Define TypeScript interfaces for SEPA credit transfer payloads including mandatory debtor and creditor international bank account numbers. | ts | import { z } from 'zod';
import { isValid } from 'iban';
// Define the IBAN schema.
export const ibanSchema = z.string().refine(isValid, 'Invalid IBAN');
export const bicSchema = z.string().regex(/^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$/, 'Invalid BIC format');
export interface SepaCreditTransferPayload {
endTo... | 50 | false | true | false | true | false | false | false | false | true | false | type_safety_hole | 3 | obvious | [] | [
{
"finding_slug": "noise-comments-7525d027dbc6-l4-l4-80e3b503",
"flag": "noise_comments",
"start_line": 4,
"end_line": 4,
"excerpt": "// Define the IBAN schema.",
"explanation": "Merely restates the immediately following schema declaration.",
"audit_verdict": "valid"
},
{
"findin... |
dispatch-automated-reminder-emails-to-recipients-who-have-not-viewed-their-assigned-documents-within-three-days-js-5f6d727d086c | dispatch-automated-reminder-emails-to-recipients-who-have-not-viewed-their-assigned-documents-within-three-days | document-signing | async-job | Dispatch automated reminder emails to recipients who have not viewed their assigned documents within three days. | js | import { z } from 'zod';
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { DynamoDBDocumentClient, QueryCommand } from '@aws-sdk/lib-dynamodb';
import { SESClient, SendEmailCommand } from '@aws-sdk/client-ses';
const store = DynamoDBDocumentClient.from(new DynamoDBClient({ region: 'us-east-1' }));
co... | 46 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
render-a-collapsible-sidebar-listing-all-joined-communication-channels-with-unread-badges-and-contextual-action-menus-tsx-3a404295343a | render-a-collapsible-sidebar-listing-all-joined-communication-channels-with-unread-badges-and-contextual-action-menus | messaging | react-component | Render a collapsible sidebar listing all joined communication channels with unread badges and contextual action menus. | tsx | import { useState } from 'react';
interface Channel {
id: string;
name: string;
isPrivate: boolean;
unreadCount: number;
}
interface ChannelSidebarProps {
channels: Channel[];
activeChannelId: string;
onSelectChannel: (channelId: string) => void;
onOpenChannelSettings: (channelId: string) => void;
}
e... | 42 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
provide-a-debounced-custom-hook-that-returns-geolocation-bounding-box-coordinates-while-moving-map-bounds-ts-02602ef5a44c | provide-a-debounced-custom-hook-that-returns-geolocation-bounding-box-coordinates-while-moving-map-bounds | property-listings | react-hook | Provide a debounced custom hook that returns geolocation bounding box coordinates while moving map bounds. | ts | import { useEffect, useState } from "react"
import { debounce } from "lodash-es"
export type GeolocationBoundingBox = {
southWestLat: number
southWestLng: number
northEastLat: number
northEastLng: number
}
export function useMapBoundingBox(mapInstance: google.maps.Map | null): GeolocationBoundingBox | null {
... | 48 | false | false | false | false | false | false | false | true | false | false | error_handling_problem | 3 | subtle | [] | [
{
"finding_slug": "error-handling-problem-02602ef5a44c-l33-l35-bfcbdcd5",
"flag": "error_handling_problem",
"start_line": 33,
"end_line": 35,
"excerpt": " } catch {",
"explanation": "Any exception while reading or publishing bounds is discarded and converted to null, the same result use... |
manage-active-timer-state-elapsed-duration-counters-and-running-project-tags-inside-a-global-store-slice-tsx-4325b44b0163 | manage-active-timer-state-elapsed-duration-counters-and-running-project-tags-inside-a-global-store-slice | time-tracking | state-management | Manage active timer state, elapsed duration counters, and running project tags inside a global store slice. | tsx | import { createContext, useContext, useEffect, useReducer } from "react";
import type { Dispatch, ReactNode } from "react";
interface ActiveTimerState {
isRunning: boolean;
elapsedSeconds: number;
activeProjectId: string | null;
activeTaskDescription: string;
}
type TimerAction =
| { type: "START_... | 61 | false | false | false | false | false | false | false | false | true | false | type_safety_hole | 3 | subtle | [] | [
{
"finding_slug": "type-safety-hole-4325b44b0163-l12-l12-969dbc87",
"flag": "type_safety_hole",
"start_line": 12,
"end_line": 12,
"excerpt": " | { type: \"START_TIMER\"; projectId: any; taskDescription: any }",
"explanation": "projectId is typed as any and assigned directly to activeProje... |
define-the-complete-typescript-interfaces-for-invoice-line-items-discount-structures-and-payment-allocations-ts-ff501a410fe5 | define-the-complete-typescript-interfaces-for-invoice-line-items-discount-structures-and-payment-allocations | invoicing | type-definitions | Define the complete TypeScript interfaces for invoice line items, discount structures, and payment allocations. | ts | import { z } from "zod";
const identifier = z.string().uuid();
const currency = z.string().length(3).regex(/^[A-Z]{3}$/);
const cents = z.number().finite().int().nonnegative();
const basisPoints = z.number().int().min(0).max(10000);
export const DiscountSchema = z.discriminatedUnion("kind", [
z.object({ kind: z.lite... | 26 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
calculate-business-hours-elapsed-between-two-timestamps-by-excluding-configured-national-holidays-and-weekend-dates-ts-6f6736643af8 | 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;
export function elapsedBusinessHours(
start: number,
end: number,
nationalHolidays: readonly string[]
): number {
const validTimestamp = (timestamp: number): boolean =>
Number.isFinite(timestamp) && Number.isFinite(new Date(timestamp... | 35 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
track-window-dimensions-and-return-responsive-breakpoint-flags-for-collapsing-the-customer-relationship-sidebar-ts-5e6d7627e9e3 | track-window-dimensions-and-return-responsive-breakpoint-flags-for-collapsing-the-customer-relationship-sidebar | crm | react-hook | Track window dimensions and return responsive breakpoint flags for collapsing the customer relationship sidebar. | ts | import { useState, useEffect } from 'react';
const MOBILE_BREAKPOINT_PX = 768;
const TABLET_BREAKPOINT_PX = 1024;
export interface CustomerSidebarResponsiveState {
isMobileView: boolean;
isTabletView: boolean;
windowWidth: number;
}
export function useCustomerSidebarBreakpoint(): CustomerSidebarResponsiveState {
... | 31 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
handle-incoming-http-put-requests-to-update-user-contact-details-and-return-updated-profile-resources-js-a268fb2a8d1e | handle-incoming-http-put-requests-to-update-user-contact-details-and-return-updated-profile-resources | user-profiles | http-handler | Handle incoming HTTP PUT requests to update user contact details and return updated profile resources. | js | const Router = require('@koa/router')
const { validateContactDetails } = require('../validators/userProfileValidator')
const { updateContactDetails } = require('../services/userService')
const router = new Router()
router.put('/users/:userId/contact', (ctx) => {
const { userId } = ctx.params
if (typeof userId !==... | 49 | false | true | false | false | false | true | false | false | false | false | too_clever | 4 | borderline | [
"too_clever"
] | [
{
"finding_slug": "noise-comments-a268fb2a8d1e-l18-l18-efb70eab",
"flag": "noise_comments",
"start_line": 18,
"end_line": 18,
"excerpt": " // Update the user's contact details",
"explanation": "The comment only repeats the immediately following function call.",
"audit_verdict": "val... |
manage-the-oauth-authorization-redirect-lifecycle-and-capture-authorization-codes-returned-from-identity-providers-js-d4777417c575 | manage-the-oauth-authorization-redirect-lifecycle-and-capture-authorization-codes-returned-from-identity-providers | auth | react-hook | Manage the OAuth authorization redirect lifecycle and capture authorization codes returned from identity providers | js | import { useEffect, useState } from 'react';
export function useOAuthRedirect(expectedState) {
const [result, setResult] = useState({ code: null, error: null });
useEffect(() => {
const capture = () => {
const url = new URL(window.location.href);
const params = url.searchParams;
if (!params.h... | 35 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
process-appointment-cancellation-requests-by-releasing-reserved-room-resources-and-notifying-assigned-staff-members-ts-22793056e128 | process-appointment-cancellation-requests-by-releasing-reserved-room-resources-and-notifying-assigned-staff-members | scheduling | server-action | Process appointment cancellation requests by releasing reserved room resources and notifying assigned staff members. | ts | "use server"
import { db } from "@/server/db"
import { requireScheduler } from "@/server/auth"
export async function cancelAppointment(input: { appointmentId: string }) {
const { appointmentId } = input
const scheduler = await requireScheduler()
await db.$transaction(async transaction => {
const appointment... | 26 | false | false | true | false | false | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "unsafe-input-22793056e128-l6-l11-36ca2fc2",
"flag": "unsafe_input",
"start_line": 6,
"end_line": 11,
"excerpt": "export async function cancelAppointment(input: { appointmentId: string }) {",
"explanation": "This server action destructures externally supplied input and uses... |
verify-user-authorization-tokens-before-generating-presigned-upload-urls-for-secure-direct-browser-media-transfers-ts-0f41d4b2c55e | verify-user-authorization-tokens-before-generating-presigned-upload-urls-for-secure-direct-browser-media-transfers | file-uploads | server-action | Verify user authorization tokens before generating presigned upload URLs for secure direct browser media transfers. | ts | import { error, type Actions } from "@sveltejs/kit"
import { jwtVerify } from "jose"
import { z } from "zod"
import { randomUUID } from "node:crypto"
import { PutObjectCommand } from "@aws-sdk/client-s3"
import { getSignedUrl } from "@aws-sdk/s3-request-presigner"
import { mediaBucket, storage, uploadVerificationKey } ... | 43 | false | false | false | false | false | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "unsafe-input-0f41d4b2c55e-l29-l29-e8627c50",
"flag": "unsafe_input",
"start_line": 29,
"end_line": 29,
"excerpt": " const mime = String(form.get(\"mime\"))",
"explanation": "String conversion does not validate a request-supplied MIME value, so missing fields... |
render-a-rich-text-toolbar-allowing-marketers-to-insert-personalization-tokens-into-their-email-body-tsx-a57643c43481 | render-a-rich-text-toolbar-allowing-marketers-to-insert-personalization-tokens-into-their-email-body | email-campaigns | react-component | Render a rich text toolbar allowing marketers to insert personalization tokens into their email body. | tsx | import { useState } from 'react';
interface PersonalizationToolbarProps {
onInsertToken: (token: string) => void;
}
const subscriberFields = ['firstName', 'lastName', 'company'];
const unsubscribePath = 'campaign.unsubscribeUrl';
export function PersonalizationToolbar({ onInsertToken }: PersonalizationToolbarProps)... | 43 | false | false | false | false | false | true | false | false | false | false | too_clever | 4 | borderline | [
"too_clever"
] | [
{
"finding_slug": "too-clever-a57643c43481-l29-l29-24121e2e",
"flag": "too_clever",
"start_line": 29,
"end_line": 29,
"excerpt": "\t\t\t\tconst label = field === 'firstName' ? 'First Name' : field === 'lastName' ? 'Last Name' : 'Company';",
"explanation": "The nested ternary embeds the label... |
submit-a-form-mutation-to-revoke-all-active-sessions-when-an-administrator-downgrades-a-user-tier-js-e1844e1a5283 | submit-a-form-mutation-to-revoke-all-active-sessions-when-an-administrator-downgrades-a-user-tier | permissions | server-action | Submit a form mutation to revoke all active sessions when an administrator downgrades a user tier. | js | const { defineEventHandler, readBody, createError } = require('h3');
const { requireAdministrator } = require('../utils/auth');
const { getUserForTierChange, updateUserTier } = require('../services/userService');
const { revokeAllUserSessions } = require('../services/sessionService');
module.exports = defineEventHandl... | 48 | false | false | false | false | false | false | false | true | false | true | error_handling_problem | 1 | subtle | [] | [
{
"finding_slug": "unsafe-input-e1844e1a5283-l13-l27-1ddcb84e",
"flag": "unsafe_input",
"start_line": 13,
"end_line": 27,
"excerpt": " const { targetUserId, requestedTier } = body;",
"explanation": "The object-shape check does not validate targetUserId or requestedTier, so an unchecked user... |
construct-an-api-endpoint-accepting-paginated-product-search-queries-and-returning-filtered-catalog-results-with-total-counts-js-9a2e9a869640 | construct-an-api-endpoint-accepting-paginated-product-search-queries-and-returning-filtered-catalog-results-with-total-counts | product-catalog | http-handler | Construct an API endpoint accepting paginated product search queries and returning filtered catalog results with total counts. | js | export default function catalogRoutes(fastify, options, done) {
const { catalog } = options;
const searchSchema = {
type: "object",
additionalProperties: false,
properties: {
q: { type: "string", maxLength: 200, default: "" },
category: { type: "string", minLength: 1, maxLength: 80 },
page: { type: "in... | 48 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
process-attendee-registration-submissions-reserve-requested-seats-in-the-database-and-generate-invoice-records-ts-3737676f9528 | process-attendee-registration-submissions-reserve-requested-seats-in-the-database-and-generate-invoice-records | event-ticketing | server-action | Process attendee registration submissions, reserve requested seats in the database, and generate invoice records. | ts | import { z } from 'zod';
import { TRPCError } from '@trpc/server';
import { db } from '@/server/db';
import { createTRPCRouter, protectedProcedure } from '@/server/api/trpc';
const registrationSchema = z.object({
eventId: z.string().uuid(),
ticketTierId: z.string().uuid(),
quantity: z.number().int().positi... | 40 | false | false | false | false | false | false | false | false | true | false | type_safety_hole | 4 | borderline | [
"type_safety_hole"
] | [
{
"finding_slug": "type-safety-hole-3737676f9528-l34-l34-89fafcf4",
"flag": "type_safety_hole",
"start_line": 34,
"end_line": 34,
"excerpt": " amountDue: tier!.price * quantity, status: 'PENDING', billingEmail: attendeeEmail,",
"explanation": "The non-null assertion bypass... |
execute-checkout-redirection-by-validating-inventory-stock-levels-and-generating-a-temporary-payment-session-token-ts-5acf2fe5f58c | execute-checkout-redirection-by-validating-inventory-stock-levels-and-generating-a-temporary-payment-session-token | shopping-cart | server-action | Execute checkout redirection by validating inventory stock levels and generating a temporary payment session token | ts | import { fail, redirect } from '@sveltejs/kit';
import { randomUUID } from 'node:crypto';
import { z } from 'zod';
import { inventory, paymentSessions } from '$lib/server/checkout';
import type { Actions } from './$types';
const checkoutInput = z.object({
sku: z.string().trim().min(1).max(80)
});
export const actio... | 37 | false | true | false | false | false | false | false | false | false | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "unsafe-input-5acf2fe5f58c-l20-l20-5472be8a",
"flag": "unsafe_input",
"start_line": 20,
"end_line": 20,
"excerpt": " const quantity = Number(form.get('quantity'));",
"explanation": "Only the SKU is schema-validated, leaving the quantity conversion unchecked rather than v... |
provision-the-first-administrative-superuser-account-in-the-production-database-using-environment-secrets-ts-cd46b421468f | provision-the-first-administrative-superuser-account-in-the-production-database-using-environment-secrets | auth | cli-script | Provision the first administrative superuser account in the production database using environment secrets | ts | import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { DatabaseConnection } from '../services/database';
import { PasswordService } from '../services/password';
async function main(): Promise<void> {
const argv = await yargs(hideBin(process.argv))
.option('email', { type: 'string', de... | 36 | false | false | false | false | false | false | false | true | true | true | unsafe_input | 2 | subtle | [] | [
{
"finding_slug": "type-safety-hole-cd46b421468f-l12-l12-6cdb1573",
"flag": "type_safety_hole",
"start_line": 12,
"end_line": 12,
"excerpt": " const secret = process.env.INITIAL_ADMIN_SECRET!;",
"explanation": "The non-null assertion removes undefined from the type without establishing th... |
validate-that-attempting-to-access-forbidden-administrative-routes-returns-a-structured-403-error-js-304c0a143e88 | validate-that-attempting-to-access-forbidden-administrative-routes-returns-a-structured-403-error | permissions | test | Validate that attempting to access forbidden administrative routes returns a structured 403 error. | js | import request from "supertest";
import { describe, it, expect, beforeEach } from "@jest/globals";
import { createApp } from "../src/app.js";
import { createSessionToken } from "../src/auth/session.js";
import { PermissionScope } from "../src/permissions/constants.js";
const forbiddenRoutes = [
{
name: "us... | 52 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
sanitize-user-search-inputs-by-stripping-dangerous-special-characters-and-normalizing-whitespace-js-e5f6160cfae2 | sanitize-user-search-inputs-by-stripping-dangerous-special-characters-and-normalizing-whitespace | search | utility | Sanitize user search inputs by stripping dangerous special characters and normalizing whitespace. | js | import _ from "lodash";
const DANGEROUS_CHARACTERS = /[<>&'";]/g;
export async function cleanSearchQuery(rawSearchInput) {
if (rawSearchInput == "") {
return "";
}
if (typeof rawSearchInput !== "string") {
throw new Error("Search input must be a string");
}
const strippedQuery = _.... | 18 | false | false | true | false | false | false | false | false | true | false | type_safety_hole | 3 | subtle | [] | [
{
"finding_slug": "type-safety-hole-e5f6160cfae2-l6-l8-28cb26fc",
"flag": "type_safety_hole",
"start_line": 6,
"end_line": 8,
"excerpt": " if (rawSearchInput == \"\") {",
"explanation": "Loose equality runs before type validation, so nonstrings such as 0, false, and [] compare equal to th... |
calculate-monetary-percentage-discounts-against-cart-subtotal-amounts-and-round-results-to-two-decimal-places-ts-7153de45f2f8 | calculate-monetary-percentage-discounts-against-cart-subtotal-amounts-and-round-results-to-two-decimal-places | shopping-cart | utility | Calculate monetary percentage discounts against cart subtotal amounts and round results to two decimal places | ts | import _ from "lodash"
import { z } from "zod"
const cartItemSchema = z.object({
id: z.string(),
unitPrice: z.number().finite().nonnegative(),
quantity: z.number().finite().nonnegative()
})
const discountRuleSchema = z.object({
code: z.string(),
percentage: z.number().finite().min(0).max(100)
})
export type Cart... | 31 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
calculate-total-cost-for-a-stay-duration-including-weekend-surcharges-and-local-tourist-tax-rates-ts-d07ce12fb1e3 | 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 bookingSchema = 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:... | 37 | false | false | false | false | false | true | false | false | false | false | too_clever | 4 | subtle | [] | [
{
"finding_slug": "too-clever-d07ce12fb1e3-l25-l27-652c4934",
"flag": "too_clever",
"start_line": 25,
"end_line": 27,
"excerpt": " totalCost += (65 & (1 << cursor.getUTCDay())",
"explanation": "The bitmask 65 and shifted weekday encode Sunday and Saturday opaquely, whereas an expl... |
attach-a-native-click-listener-to-the-export-audit-log-csv-button-to-trigger-a-browser-file-download-of-the-currently-filtered-event-stream-js-8bcd451806dc | attach-a-native-click-listener-to-the-export-audit-log-csv-button-to-trigger-a-browser-file-download-of-the-currently-filtered-event-stream | audit-logging | dom-code | Attach a native click listener to the export audit log CSV button to trigger a browser file download of the currently filtered event stream. | js | import { fetchAuditLogCsvExport } from './api/auditLogApiClient.js';
import { getCurrentFilterState } from './state/auditLogFilterState.js';
export function initializeAuditLogExportButton() {
const exportButton = document.getElementById('export-audit-log-csv-button');
if (exportButton === null) {
throw... | 51 | false | false | false | true | false | false | false | false | false | true | inconsistent_style | 3 | subtle | [] | [
{
"finding_slug": "inconsistent-style-8bcd451806dc-l20-l20-fed5aab1",
"flag": "inconsistent_style",
"start_line": 20,
"end_line": 20,
"excerpt": " let csv_blob;",
"explanation": "`csv_blob` uses snake_case while the surrounding local variables, including `downloadUrl` and `downloadAnc... |
render-a-responsive-course-progress-grid-with-color-coded-milestone-badges-and-clickable-completion-checkmarks-jsx-1d24a63bc5af | render-a-responsive-course-progress-grid-with-color-coded-milestone-badges-and-clickable-completion-checkmarks | course-management | react-component | Render a responsive course progress grid with color-coded milestone badges and clickable completion checkmarks. | jsx | import { useState } from 'react'
import { useForm } from 'react-hook-form'
import { z } from 'zod'
const milestonesSchema = z.array(z.object({ id: z.string().min(1), title: z.string().min(1), status: z.enum(['planned', 'active', 'achieved']), completed: z.boolean() })).refine(items => new Set(items.map(item => item.id... | 17 | false | false | false | false | false | false | false | false | false | false | none | 4 | subtle | [] | [] |
define-typescript-interfaces-representing-customer-billing-profiles-payment-methods-and-tiered-subscription-contracts-ts-83942823571a | 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',
}
export interface CardPaymentMethod {
id: string;
type: PaymentMethodType.Card;
lastFour: string;
brand: string;
expMonth: number;
expYear: number;
}... | 51 | false | false | false | false | false | false | false | false | false | false | none | 5 | obvious | [] | [] |
process-incoming-carrier-webhooks-to-update-delivery-status-milestones-and-dispatch-instant-push-notifications-to-consignees-js-c2efdea7a51d | process-incoming-carrier-webhooks-to-update-delivery-status-milestones-and-dispatch-instant-push-notifications-to-consignees | fleet-tracking | async-job | Process incoming carrier webhooks to update delivery status milestones and dispatch instant push notifications to consignees. | js | import { z } from "zod"
const carrierEvent = z.object({
eventId: z.string().min(1),
trackingNumber: z.string().min(1),
status: z.enum(["picked_up", "in_transit", "delivered"]),
occurredAt: z.string().datetime({ offset: true })
})
const notificationTitles = {
picked_up: "Your parcel was collected",
... | 32 | false | false | false | false | false | false | false | false | false | false | none | 5 | subtle | [] | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.