Skip to main content
Glama
stub-detector.js778 B
const FORBIDDEN_PATTERNS = [ "TODO", "FIXME", "not implemented", "NotImplemented", "placeholder", "stub", "simulate", "simulated", "fake", ]; const FORBIDDEN_REGEX = [ /^\s*return\s+null\s*;/m, /^\s*return\s+\{\s*\}\s*;/m, /^\s*return\s+\[\s*\]\s*;/m, /^\s*throw\s+new\s+Error\(\s*["']not implemented["']\s*\)/im, ]; export function detectStubs(content) { const hits = []; for (const pattern of FORBIDDEN_PATTERNS) { if (content.includes(pattern)) { hits.push(`forbidden pattern: "${pattern}"`); } } for (const regex of FORBIDDEN_REGEX) { if (regex.test(content)) { hits.push(`forbidden stub regex: ${regex}`); } } if (hits.length > 0) { throw new Error(`STUB_DETECTED:\n- ${hits.join("\n- ")}`); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dylanmarriner/MCP-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server