Skip to content

Commit 65258bf

Browse files
r4topunkclaude
andauthored
chore: cleanup code smells from truecourse audit (#74)
* chore: cleanup code smells from truecourse audit Remove unused React imports (4 files), consolidate duplicate imports (5 files), delete unused getEnrichedPropdatesList export, sanitize error messages in 4 API routes (no longer leak internal exception details), ignore .truecourse/ analyzer output. All findings verified manually; ~90% of truecourse's 6382 flags were false positives (Web3 addresses flagged as secrets, Three.js mutation, intentional fire-and-forget promises, etc.). Only validated changes applied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: drop .gitignore entry for truecourse Not using the tool, removed its output dir too. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6aa5942 commit 65258bf

14 files changed

Lines changed: 12 additions & 54 deletions

File tree

src/app/api/coins/create/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export async function POST(req: NextRequest) {
4242
headers: { "content-type": "application/json" },
4343
});
4444
} catch (err: unknown) {
45-
const errorMessage = err instanceof Error ? err.message : String(err);
46-
return new Response(JSON.stringify({ error: errorMessage }), {
45+
console.error("[api/coins/create] failed:", err);
46+
return new Response(JSON.stringify({ error: "Failed to create coin call data" }), {
4747
status: 500,
4848
headers: { "content-type": "application/json" },
4949
});

src/app/api/delegators/[address]/route.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ export async function GET(
1919
const delegators = await fetchDelegatorsWithCounts(address);
2020
return NextResponse.json(delegators);
2121
} catch (error) {
22-
const message = error instanceof Error ? error.message : "Unknown error";
2322
console.error("Failed to fetch delegators:", error);
24-
return NextResponse.json({ error: message }, { status: 500 });
23+
return NextResponse.json({ error: "Failed to fetch delegators" }, { status: 500 });
2524
}
2625
}

src/app/api/members/active/route.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ export async function GET(request: Request) {
3535
headers: { "Cache-Control": "public, s-maxage=300, stale-while-revalidate=600" },
3636
});
3737
} catch (error) {
38-
const message = error instanceof Error ? error.message : "Unknown error";
3938
console.error("Failed to fetch active members:", error);
40-
return NextResponse.json({ error: message }, { status: 500 });
39+
return NextResponse.json({ error: "Failed to fetch active members" }, { status: 500 });
4140
}
4241
}
4342

src/app/api/members/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export async function GET(request: Request) {
8080

8181
return NextResponse.json({ members: filtered });
8282
} catch (error) {
83-
const message = error instanceof Error ? error.message : "Unknown error";
84-
return NextResponse.json({ error: message }, { status: 500 });
83+
console.error("[api/members] failed:", error);
84+
return NextResponse.json({ error: "Failed to fetch members" }, { status: 500 });
8585
}
8686
}

src/components/bounties/BountyDetailView.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import remarkGfm from 'remark-gfm';
2323
import rehypeRaw from 'rehype-raw';
2424
import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
2525
import type { PoidhBounty } from '@/types/poidh';
26-
import { CHAIN_NAMES, getExplorerUrl, getTxUrl } from '@/lib/poidh/config';
26+
import { CHAIN_NAMES, getExplorerUrl, getTxUrl, POIDH_CONTRACTS } from '@/lib/poidh/config';
2727
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
2828
import { Badge } from '@/components/ui/badge';
2929
import { Button } from '@/components/ui/button';
@@ -34,7 +34,6 @@ import { MediaEmbed } from '@/components/bounties/MediaEmbed';
3434
import { AddressDisplay } from '@/components/ui/address-display';
3535
import { usePoidhCancelBounty, usePoidhJoinBounty, usePoidhWithdrawFromBounty, usePoidhAcceptClaim, usePoidhSubmitClaimForVote, usePoidhVoteClaim, usePoidhResolveVote } from '@/hooks/usePoidhContract';
3636
import { POIDH_ABI } from '@/lib/poidh/abi';
37-
import { POIDH_CONTRACTS } from '@/lib/poidh/config';
3837
import { useEthPrice, formatEthToUsd } from '@/hooks/use-eth-price';
3938
import { useUserAddress } from '@/hooks/use-user-address';
4039
import { getThirdwebClient } from '@/lib/thirdweb';

src/components/feed/AdminEventCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import { Settings, Crown, Send } from "lucide-react";
1111
import { Card, CardContent } from "@/components/ui/card";
1212
import { Badge } from "@/components/ui/badge";
1313
import { AddressDisplay } from "@/components/ui/address-display";
14-
import { cn } from "@/lib/utils";
15-
import { formatETH } from "@/lib/utils";
14+
import { cn, formatETH } from "@/lib/utils";
1615
import type { FeedEvent } from "@/lib/types/feed-events";
1716

1817
export interface AdminEventCardProps {

src/components/feed/AuctionEventCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import { Card, CardContent } from "@/components/ui/card";
1414
import { Badge } from "@/components/ui/badge";
1515
import { AddressDisplay } from "@/components/ui/address-display";
1616
import { TokenImage } from "@/components/ui/token-image";
17-
import { cn } from "@/lib/utils";
18-
import { formatETH } from "@/lib/utils";
17+
import { cn, formatETH } from "@/lib/utils";
1918
import type { FeedEvent } from "@/lib/types/feed-events";
2019
import { useBidComments } from "@/hooks/use-bid-comments";
2120

src/components/layout/MuralBackground.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import React, { useRef, useState, useEffect } from "react";
3+
import { useRef, useState, useEffect } from "react";
44
import { motion } from "framer-motion";
55
import { fetchAllAuctions, type PastAuction } from "@/services/auctions";
66

src/components/layout/ThemeToggle.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client";
22

3-
import * as React from "react";
43
import { Moon, Sun, Monitor } from "lucide-react";
54
import { useTheme } from "next-themes";
65
import { Button } from "@/components/ui/button";

src/components/proposals/builder/forms/custom-transaction-form.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react";
21
import { Info } from "lucide-react";
32
import { useFormContext } from "react-hook-form";
43
import { Alert, AlertDescription } from "@/components/ui/alert";

0 commit comments

Comments
 (0)