MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / detectAvailableLinter

Function detectAvailableLinter

src/tools/static-analysis.ts:40–72  ·  view source on GitHub ↗
(rootDir: string, ext: string)

Source from the content-addressed store, hash-verified

38}
39
40async function detectAvailableLinter(rootDir: string, ext: string): Promise<{ cmd: string; args: string[] } | null> {
41 const config = LINTER_MAP[ext];
42 if (!config) return null;
43
44 if (ext === ".ts" || ext === ".tsx") {
45 try {
46 await stat(resolve(rootDir, "tsconfig.json"));
47 return config;
48 } catch {
49 return null;
50 }
51 }
52
53 if (ext === ".rs") {
54 try {
55 await stat(resolve(rootDir, "Cargo.toml"));
56 return config;
57 } catch {
58 return null;
59 }
60 }
61
62 if (ext === ".go") {
63 try {
64 await stat(resolve(rootDir, "go.mod"));
65 return config;
66 } catch {
67 return null;
68 }
69 }
70
71 return config;
72}
73
74export async function runStaticAnalysis(options: StaticAnalysisOptions): Promise<string> {
75 const targetPath = options.targetPath ? resolve(options.rootDir, options.targetPath) : options.rootDir;

Callers 1

runStaticAnalysisFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected