fix: remove unused imports and variables flagged by CodeQL

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gnanam1990
2026-04-09 17:34:22 +05:30
parent 81896618a1
commit a36639034b
5 changed files with 5 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
import { describe, expect, test, mock, beforeEach } from 'bun:test'
import { describe, expect, test } from 'bun:test'
// The feature() function from bun:bundle is shimmed at build time.
// In tests, it's not available, so we test the getRepoMapContext logic

View File

@@ -1,5 +1,5 @@
import { execFile } from 'child_process'
import { readdirSync, statSync } from 'fs'
import { readdirSync } from 'fs'
import { join, relative } from 'path'
import type { SupportedLanguage } from './types.js'

View File

@@ -20,8 +20,6 @@ export function rankFiles(
): RankedFile[] {
if (graph.order === 0) return []
// Build personalization vector
const focusSet = new Set(focusFiles)
const hasPersonalization = focusFiles.length > 0
// graphology-pagerank accepts getEdgeWeight option

View File

@@ -1,5 +1,5 @@
import { afterEach, beforeAll, describe, expect, test } from 'bun:test'
import { cpSync, existsSync, mkdirSync, mkdtempSync, rmSync, utimesSync, writeFileSync } from 'fs'
import { cpSync, mkdtempSync, rmSync, utimesSync, writeFileSync } from 'fs'
import { tmpdir } from 'os'
import { join } from 'path'
import { invalidateCache, buildRepoMap } from './index.js'
@@ -134,7 +134,6 @@ describe('renderer', () => {
// Every file header in the output should have its signatures listed
for (const header of fileHeaders) {
const fileName = header.slice(0, -1) // remove trailing ':'
// The file must have at least one signature line after it
const headerIdx = result.map.indexOf(header)
const afterHeader = result.map.slice(headerIdx + header.length)

View File

@@ -1,8 +1,7 @@
import { afterEach, beforeAll, describe, expect, test } from 'bun:test'
import { cpSync, mkdtempSync, rmSync, writeFileSync } from 'fs'
import { beforeAll, describe, expect, test } from 'bun:test'
import { cpSync, mkdtempSync, rmSync } from 'fs'
import { tmpdir } from 'os'
import { join } from 'path'
import { z } from 'zod/v4'
import { initParser } from '../../context/repoMap/parser.js'
import { invalidateCache } from '../../context/repoMap/index.js'
import { RepoMapTool } from './RepoMapTool.js'
@@ -29,24 +28,6 @@ beforeAll(async () => {
await initParser()
})
// Minimal context stub for tool.call
function makeContext(root: string) {
// Patch getCwd to return our test root
process.env.__TEST_CWD_OVERRIDE = root
return {
abortController: new AbortController(),
getAppState: () => ({
toolPermissionContext: {
mode: 'default' as const,
additionalWorkingDirectories: new Map(),
alwaysAllowRules: {},
alwaysDenyRules: {},
alwaysAskRules: {},
isBypassPermissionsModeAvailable: false,
},
}),
} as any
}
describe('RepoMapTool schema', () => {
test('validates a minimal input {}', () => {